diff --git a/Plugins/BuildFiles/common.xml b/Plugins/BuildFiles/common.xml index 046f3b38d..83c66238c 100644 --- a/Plugins/BuildFiles/common.xml +++ b/Plugins/BuildFiles/common.xml @@ -108,6 +108,7 @@ + diff --git a/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java b/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java index 6b53fbbf4..5ac39b904 100644 --- a/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java +++ b/Plugins/Core/src/me/chiss/Core/Loot/LootBase.java @@ -13,7 +13,7 @@ import mineplex.core.itemstack.ItemStackFactory; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateData.java b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateData.java index 43dd29569..c7a14a530 100644 --- a/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateData.java +++ b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateData.java @@ -4,8 +4,8 @@ import java.util.HashSet; import org.bukkit.Chunk; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.CraftChunk; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.CraftChunk; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; public class BlockRegenerateData { @@ -46,7 +46,7 @@ public class BlockRegenerateData //if (_loc.getBlock().getType() == Material.CHEST) // return; - net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle(); + net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)_loc.getChunk()).getHandle(); c.a(_loc.getBlockX() & 0xF, _loc.getBlockY(), _loc.getBlockZ() & 0xF, _id, _data); ((CraftWorld)_loc.getChunk().getWorld()).getHandle().notify(_loc.getBlockX(), _loc.getBlockY(), _loc.getBlockZ()); diff --git a/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java index 8553e7691..ebb44dc4b 100644 --- a/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java +++ b/Plugins/Core/src/me/chiss/Core/Modules/BlockRegenerateSet.java @@ -5,7 +5,7 @@ import java.util.HashSet; import org.bukkit.Chunk; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.CraftChunk; +import org.bukkit.craftbukkit.v1_7_R1.CraftChunk; public class BlockRegenerateSet { @@ -61,7 +61,7 @@ public class BlockRegenerateSet { for (Chunk chunk : _chunks) { - net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)chunk).getHandle(); + net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)chunk).getHandle(); c.initLighting(); } } diff --git a/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java b/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java index 16b6ecf37..211016f6e 100644 --- a/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java +++ b/Plugins/Core/src/me/chiss/Core/Modules/PlayerInfo.java @@ -7,7 +7,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; diff --git a/Plugins/Core/src/me/chiss/Core/Modules/Tester.java b/Plugins/Core/src/me/chiss/Core/Modules/Tester.java index 690df00ff..e0d88188d 100644 --- a/Plugins/Core/src/me/chiss/Core/Modules/Tester.java +++ b/Plugins/Core/src/me/chiss/Core/Modules/Tester.java @@ -11,24 +11,24 @@ import mineplex.core.fakeEntity.FakeEntityManager; import mineplex.core.fakeEntity.FakePlayer; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet28EntityVelocity; -import net.minecraft.server.v1_6_R3.Packet31RelEntityMove; -import net.minecraft.server.v1_6_R3.Packet34EntityTeleport; -import net.minecraft.server.v1_6_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_7_R1.EntityInsentient; +import net.minecraft.server.v1_7_R1.EntityLiving; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet28EntityVelocity; +import net.minecraft.server.v1_7_R1.Packet31RelEntityMove; +import net.minecraft.server.v1_7_R1.Packet34EntityTeleport; +import net.minecraft.server.v1_7_R1.PathfinderGoalSelector; import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftAgeable; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftAgeable; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; diff --git a/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java b/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java index b4b37d874..6f155501e 100644 --- a/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java +++ b/Plugins/Core/src/me/chiss/Core/Modules/UpdateThread.java @@ -7,8 +7,8 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.UtilAlg; import mineplex.core.fakeEntity.FakeEntity; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet28EntityVelocity; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Packet28EntityVelocity; public class UpdateThread extends Thread { diff --git a/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java b/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java index 66b91e753..52c719e7f 100644 --- a/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java +++ b/Plugins/Core/src/me/chiss/Core/Utility/InventoryUtil.java @@ -2,7 +2,7 @@ package me.chiss.Core.Utility; import java.util.HashMap; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory; import org.bukkit.inventory.ItemStack; public class InventoryUtil diff --git a/Plugins/Libraries/craftbukkit.jar b/Plugins/Libraries/craftbukkit.jar index 2b388b783..87c2c6d75 100644 Binary files a/Plugins/Libraries/craftbukkit.jar and b/Plugins/Libraries/craftbukkit.jar differ diff --git a/Plugins/Libraries/craftbukkit_official.jar b/Plugins/Libraries/craftbukkit_official.jar index 758c3b0f7..41228601d 100644 Binary files a/Plugins/Libraries/craftbukkit_official.jar and b/Plugins/Libraries/craftbukkit_official.jar differ diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java index f7771c41f..4e73f79e2 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/InventoryUtil.java @@ -2,7 +2,7 @@ package mineplex.core.common.util; import java.util.HashMap; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory; import org.bukkit.inventory.ItemStack; public class InventoryUtil diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index 58318820c..c2c1d56cf 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -3,30 +3,31 @@ package mineplex.core.common.util; import java.io.File; import java.io.RandomAccessFile; import java.lang.reflect.Field; +import java.rmi.registry.Registry; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.ChunkCoordIntPair; -import net.minecraft.server.v1_6_R3.ChunkSection; -import net.minecraft.server.v1_6_R3.IContainer; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.Packet52MultiBlockChange; -import net.minecraft.server.v1_6_R3.PlayerChunkMap; -import net.minecraft.server.v1_6_R3.RegionFile; +import net.minecraft.server.v1_7_R1.Block; +import net.minecraft.server.v1_7_R1.ChunkCoordIntPair; +import net.minecraft.server.v1_7_R1.ChunkSection; +import net.minecraft.server.v1_7_R1.IContainer; +import net.minecraft.server.v1_7_R1.MinecraftServer; +import net.minecraft.server.v1_7_R1.PacketPlayOutMultiBlockChange; +import net.minecraft.server.v1_7_R1.PlayerChunkMap; +import net.minecraft.server.v1_7_R1.RegionFile; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_6_R3.CraftChunk; -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.CraftChunk; +import org.bukkit.craftbukkit.v1_7_R1.CraftServer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.world.WorldUnloadEvent; @@ -37,7 +38,7 @@ public class MapUtil { public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer) { - net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)chunk).getHandle(); + net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)chunk).getHandle(); for(int x = 0; x < 16; x++) { @@ -45,11 +46,11 @@ public class MapUtil { for(int y = 0; y < 18; y++) { - int bX = c.x << 4 | x & 0xF; + int bX = c.locX << 4 | x & 0xF; int bY = y & 0xFF; - int bZ = c.z << 4 | z & 0xF; + int bZ = c.locZ << 4 | z & 0xF; - if(c.getTypeId(bX & 0xF, bY, bZ & 0xF) == replacee.getId()) + if(c.getType(bX & 0xF, bY, bZ & 0xF).k() == replacee.getId()) { c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId()); } @@ -83,9 +84,9 @@ public class MapUtil public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data) { Chunk chunk = world.getChunkAt(x >> 4, z >> 4); - net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)chunk).getHandle(); + net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)chunk).getHandle(); - c.a(x & 0xF, y, z & 0xF, id, data); + c.a(x & 0xF, y, z & 0xF, Block.e(id), data); ((CraftWorld)world).getHandle().notify(x, y, z); } @@ -128,16 +129,16 @@ public class MapUtil return totalHeight / count; } - public static void ResendChunksForNearbyPlayers(Collection chunks) + public static void ResendChunksForNearbyPlayers(Collection chunks) { - for (net.minecraft.server.v1_6_R3.Chunk c : chunks) + for (net.minecraft.server.v1_7_R1.Chunk c : chunks) { for (Player player : Bukkit.getOnlinePlayers()) { Vector pV = player.getLocation().toVector(); - int xDist = Math.abs((pV.getBlockX() >> 4) - c.x); - int zDist = Math.abs((pV.getBlockZ() >> 4) - c.z); + int xDist = Math.abs((pV.getBlockX() >> 4) - c.locX); + int zDist = Math.abs((pV.getBlockZ() >> 4) - c.locZ); if (xDist + zDist <= 12) { @@ -147,32 +148,33 @@ public class MapUtil } } - public static net.minecraft.server.v1_6_R3.Chunk ChunkBlockChange(Location location, int id, byte data) + public static net.minecraft.server.v1_7_R1.Chunk ChunkBlockChange(Location location, int id, byte data) { return ChunkBlockChange(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), id, data); } - public static net.minecraft.server.v1_6_R3.Chunk ChunkBlockChange(World world, int x, int y, int z, int id, byte data) + public static net.minecraft.server.v1_7_R1.Chunk ChunkBlockChange(World world, int x, int y, int z, int id, byte data) { - net.minecraft.server.v1_6_R3.Chunk c = ((CraftChunk)world.getChunkAt(x >> 4, z >> 4)).getHandle(); - + net.minecraft.server.v1_7_R1.Chunk c = ((CraftChunk)world.getChunkAt(x >> 4, z >> 4)).getHandle(); + Block block = Block.e(id); + x = x & 0xF; z = z & 0xF; - int l1 = c.getTypeId(x, y, z); + int l1 = c.getType(x, y, z).k(); int i2 = c.getData(x, y, z); - ChunkSection chunksection = c.i()[(y >> 4)]; + ChunkSection chunksection = c.i()[(y >> 4)] == null ? new ChunkSection(y >> 4 << 4, !c.world.worldProvider.g) : c.i()[(y >> 4)]; - int j2 = c.x * 16 + x; - int k2 = c.z * 16 + z; + int j2 = c.locX * 16 + x; + int k2 = c.locZ * 16 + z; if ((l1 != 0) && (!c.world.isStatic)) - Block.byId[l1].l(c.world, j2, y, k2, i2); + Block.e(l1).f(c.world, j2, y, k2, i2); + + chunksection.setTypeId(x, y & 0xF, z, block); - chunksection.setTypeId(x, y & 0xF, z, id); - - if (chunksection.getTypeId(x, y & 0xF, z) != id) + if (chunksection.getTypeId(x, y & 0xF, z) != block) { return null; } @@ -182,9 +184,9 @@ public class MapUtil return c; } - public static void SendChunkForPlayer(net.minecraft.server.v1_6_R3.Chunk chunk, Player player) + public static void SendChunkForPlayer(net.minecraft.server.v1_7_R1.Chunk chunk, Player player) { - SendChunkForPlayer(chunk.x, chunk.z, player); + SendChunkForPlayer(chunk.locX, chunk.locZ, player); } @SuppressWarnings("unchecked") @@ -198,7 +200,7 @@ public class MapUtil public static void SendMultiBlockForPlayer(int x, int z, short[] dirtyBlocks, int dirtyCount, World world, Player player) { //System.out.println("Sending MultiBlockChunk " + x + ", " + z); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet52MultiBlockChange(x, z, dirtyBlocks, dirtyCount, ((CraftWorld)world).getHandle())); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutMultiBlockChange(dirtyCount, dirtyBlocks, ((CraftWorld)world).getHandle().getChunkAt(x, z))); } public static void UnloadWorld(JavaPlugin plugin, World world) @@ -215,11 +217,11 @@ public class MapUtil Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld)world).getHandle().getWorld())); - Iterator chunkIterator = ((CraftWorld)world).getHandle().chunkProviderServer.chunks.values().iterator(); + Iterator chunkIterator = ((CraftWorld)world).getHandle().chunkProviderServer.chunks.values().iterator(); while (chunkIterator.hasNext()) { - net.minecraft.server.v1_6_R3.Chunk chunk = chunkIterator.next(); + net.minecraft.server.v1_7_R1.Chunk chunk = chunkIterator.next(); chunk.removeEntities(); } @@ -273,10 +275,10 @@ public class MapUtil try { - Field a = net.minecraft.server.v1_6_R3.RegionFileCache.class.getDeclaredField("a"); + Field a = net.minecraft.server.v1_7_R1.RegionFileCache.class.getDeclaredField("a"); a.setAccessible(true); regionfiles = (HashMap) a.get(null); - rafField = net.minecraft.server.v1_6_R3.RegionFile.class.getDeclaredField("c"); + rafField = net.minecraft.server.v1_7_R1.RegionFile.class.getDeclaredField("c"); rafField.setAccessible(true); } catch (Throwable t) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java index 055025dc3..d0463fd1d 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilDisplay.java @@ -3,17 +3,17 @@ package mineplex.core.common.util; import java.lang.reflect.Field; import java.util.HashMap; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet205ClientCommand; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; -import net.minecraft.server.v1_6_R3.Packet29DestroyEntity; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; +import net.minecraft.server.v1_7_R1.DataWatcher; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayInClientCommand; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; import org.bukkit.Bukkit; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -32,8 +32,8 @@ public class UtilDisplay } //Accessing packets - public static Packet24MobSpawn getMobPacket(String text, double healthPercent, Location loc){ - Packet24MobSpawn mobPacket = new Packet24MobSpawn(); + public static PacketPlayOutSpawnEntityLiving getMobPacket(String text, double healthPercent, Location loc){ + PacketPlayOutSpawnEntityLiving mobPacket = new PacketPlayOutSpawnEntityLiving(); mobPacket.a = (int) ENTITY_ID; //Entity ID mobPacket.b = (byte) EntityType.ENDER_DRAGON.getTypeId(); //Mob type (ID: 64) @@ -49,33 +49,24 @@ public class UtilDisplay DataWatcher watcher = getWatcher(text, healthPercent * 200); - try{ - Field t = Packet24MobSpawn.class.getDeclaredField("t"); - - t.setAccessible(true); - t.set(mobPacket, watcher); - } catch(Exception e){ - e.printStackTrace(); - } + mobPacket.l = watcher; return mobPacket; } - public static Packet29DestroyEntity getDestroyEntityPacket(){ - Packet29DestroyEntity packet = new Packet29DestroyEntity(); - - packet.a = new int[]{ENTITY_ID}; + public static PacketPlayOutEntityDestroy getDestroyEntityPacket(){ + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(ENTITY_ID); return packet; } - public static Packet40EntityMetadata getMetadataPacket(DataWatcher watcher){ - Packet40EntityMetadata metaPacket = new Packet40EntityMetadata(); + public static PacketPlayOutEntityMetadata getMetadataPacket(DataWatcher watcher){ + PacketPlayOutEntityMetadata metaPacket = new PacketPlayOutEntityMetadata(); metaPacket.a = (int) ENTITY_ID; try{ - Field b = Packet40EntityMetadata.class.getDeclaredField("b"); + Field b = PacketPlayOutEntityMetadata.class.getDeclaredField("b"); b.setAccessible(true); b.set(metaPacket, watcher.c()); @@ -86,16 +77,8 @@ public class UtilDisplay return metaPacket; } - public static Packet205ClientCommand getRespawnPacket(){ - Packet205ClientCommand packet = new Packet205ClientCommand(); - - packet.a = (int) 1; - - return packet; - } - public static DataWatcher getWatcher(String text, double health){ - DataWatcher watcher = new DataWatcher(); + DataWatcher watcher = new DataWatcher(null); watcher.a(0, (Byte) (byte) 0x20); //Flags, 0x20 = invisible watcher.a(6, (Float) (float) health); @@ -109,7 +92,7 @@ public class UtilDisplay //Other methods public static void displayTextBar(JavaPlugin plugin, final Player player, double healthPercent, String text) { - Packet24MobSpawn mobPacket = getMobPacket(text, healthPercent, player.getLocation()); + PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, healthPercent, player.getLocation()); sendPacket(player, mobPacket); hasHealthBar.put(player.getName(), true); @@ -117,7 +100,7 @@ public class UtilDisplay new BukkitRunnable(){ @Override public void run(){ - Packet29DestroyEntity destroyEntityPacket = getDestroyEntityPacket(); + PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket(); sendPacket(player, destroyEntityPacket); hasHealthBar.put(player.getName(), false); @@ -126,7 +109,7 @@ public class UtilDisplay } public static void displayLoadingBar(final String text, final String completeText, final Player player, final int healthAdd, final long delay, final boolean loadUp, final JavaPlugin plugin){ - Packet24MobSpawn mobPacket = getMobPacket(text, 0, player.getLocation()); + PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(text, 0, player.getLocation()); sendPacket(player, mobPacket); hasHealthBar.put(player.getName(), true); @@ -138,7 +121,7 @@ public class UtilDisplay public void run(){ if((loadUp ? health < 200 : health > 0)){ DataWatcher watcher = getWatcher(text, health); - Packet40EntityMetadata metaPacket = getMetadataPacket(watcher); + PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher); sendPacket(player, metaPacket); @@ -149,28 +132,28 @@ public class UtilDisplay } } else { DataWatcher watcher = getWatcher(text, (loadUp ? 200 : 0)); - Packet40EntityMetadata metaPacket = getMetadataPacket(watcher); - Packet29DestroyEntity destroyEntityPacket = getDestroyEntityPacket(); + PacketPlayOutEntityMetadata metaPacket = getMetadataPacket(watcher); + PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket(); sendPacket(player, metaPacket); sendPacket(player, destroyEntityPacket); hasHealthBar.put(player.getName(), false); //Complete text - Packet24MobSpawn mobPacket = getMobPacket(completeText, 100, player.getLocation()); + PacketPlayOutSpawnEntityLiving mobPacket = getMobPacket(completeText, 100, player.getLocation()); sendPacket(player, mobPacket); hasHealthBar.put(player.getName(), true); DataWatcher watcher2 = getWatcher(completeText, 200); - Packet40EntityMetadata metaPacket2 = getMetadataPacket(watcher2); + PacketPlayOutEntityMetadata metaPacket2 = getMetadataPacket(watcher2); sendPacket(player, metaPacket2); new BukkitRunnable(){ @Override public void run(){ - Packet29DestroyEntity destroyEntityPacket = getDestroyEntityPacket(); + PacketPlayOutEntityDestroy destroyEntityPacket = getDestroyEntityPacket(); sendPacket(player, destroyEntityPacket); hasHealthBar.put(player.getName(), false); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java index 140307d9e..65c5dd9d1 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEnt.java @@ -4,33 +4,33 @@ import java.lang.reflect.Field; import java.util.HashMap; import java.util.LinkedList; -import net.minecraft.server.v1_6_R3.EntityBat; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.EntityEnderDragon; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.Navigation; -import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer; -import net.minecraft.server.v1_6_R3.PathfinderGoalMoveTowardsRestriction; -import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround; -import net.minecraft.server.v1_6_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_7_R1.EntityBat; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityEnderDragon; +import net.minecraft.server.v1_7_R1.EntityHuman; +import net.minecraft.server.v1_7_R1.EntityInsentient; +import net.minecraft.server.v1_7_R1.EntityLiving; +import net.minecraft.server.v1_7_R1.Navigation; +import net.minecraft.server.v1_7_R1.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_7_R1.PathfinderGoalMoveTowardsRestriction; +import net.minecraft.server.v1_7_R1.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_7_R1.PathfinderGoalSelector; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Giant; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; public class UtilEnt { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index 51d7186b0..41830a1ea 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -3,10 +3,10 @@ package mineplex.core.common.util; import java.lang.reflect.Field; import mineplex.core.common.util.UtilParticle.ParticleType; -import net.minecraft.server.v1_6_R3.Packet63WorldParticles; +import net.minecraft.server.v1_7_R1.PacketPlayOutWorldParticles; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; public class UtilParticle @@ -57,7 +57,7 @@ public class UtilParticle public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) { - Packet63WorldParticles packet = new Packet63WorldParticles(); + PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); for (Field field : packet.getClass().getDeclaredFields()) { diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java index f3747dc2a..d6925acf4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilText.java @@ -5,7 +5,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; -import net.minecraft.server.v1_6_R3.Chunk; +import net.minecraft.server.v1_7_R1.Chunk; import org.bukkit.Location; import org.bukkit.World; diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java index 19fa3022f..a5f79dd40 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/WorldUtil.java @@ -2,22 +2,23 @@ package mineplex.core.common.util; import java.io.File; -import net.minecraft.server.v1_6_R3.ConvertProgressUpdater; -import net.minecraft.server.v1_6_R3.Convertable; -import net.minecraft.server.v1_6_R3.EntityTracker; -import net.minecraft.server.v1_6_R3.EnumGamemode; -import net.minecraft.server.v1_6_R3.IWorldAccess; -import net.minecraft.server.v1_6_R3.ServerNBTManager; -import net.minecraft.server.v1_6_R3.WorldLoaderServer; -import net.minecraft.server.v1_6_R3.WorldManager; -import net.minecraft.server.v1_6_R3.WorldServer; -import net.minecraft.server.v1_6_R3.WorldSettings; -import net.minecraft.server.v1_6_R3.WorldType; +import net.minecraft.server.v1_7_R1.ConvertProgressUpdater; +import net.minecraft.server.v1_7_R1.Convertable; +import net.minecraft.server.v1_7_R1.EntityTracker; +import net.minecraft.server.v1_7_R1.EnumDifficulty; +import net.minecraft.server.v1_7_R1.EnumGamemode; +import net.minecraft.server.v1_7_R1.IWorldAccess; +import net.minecraft.server.v1_7_R1.ServerNBTManager; +import net.minecraft.server.v1_7_R1.WorldLoaderServer; +import net.minecraft.server.v1_7_R1.WorldManager; +import net.minecraft.server.v1_7_R1.WorldServer; +import net.minecraft.server.v1_7_R1.WorldSettings; +import net.minecraft.server.v1_7_R1.WorldType; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.WorldCreator; -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; +import org.bukkit.craftbukkit.v1_7_R1.CraftServer; import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.generator.ChunkGenerator; @@ -78,7 +79,7 @@ public class WorldUtil } while(used); boolean hardcore = false; - WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, server.getServer().getLogger(), creator.environment(), generator); + WorldServer internal = new WorldServer(server.getServer(), new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(server.getDefaultGameMode().getValue()), generateStructures, hardcore, type), server.getServer().methodProfiler, creator.environment(), generator); boolean containsWorld = false; for (World otherWorld : server.getWorlds()) @@ -93,10 +94,13 @@ public class WorldUtil if (!containsWorld) return null; + System.out.println("Created world with dimension : " + dimension); + + internal.scoreboard = server.getScoreboardManager().getMainScoreboard().getHandle(); internal.worldMaps = server.getServer().worlds.get(0).worldMaps; internal.tracker = new EntityTracker(internal); // CraftBukkit internal.addIWorldAccess((IWorldAccess) new WorldManager(server.getServer(), internal)); - internal.difficulty = 1; + internal.difficulty = EnumDifficulty.HARD; internal.setSpawnFlags(true, true); server.getServer().worlds.add(internal); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java index c222f209f..185d6290b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java @@ -8,7 +8,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.entity.Item; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/blood/Blood.java b/Plugins/Mineplex.Core/src/mineplex/core/blood/Blood.java index 517afb12e..7d148a3c5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/blood/Blood.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/blood/Blood.java @@ -32,7 +32,7 @@ public class Blood extends MiniPlugin @EventHandler public void Death(PlayerDeathEvent event) { - Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT, 1f, 1f, Material.INK_SACK, (byte)1, true); + Effects(event.getEntity().getEyeLocation(), 10, 0.5, Sound.HURT_FLESH, 1f, 1f, Material.INK_SACK, (byte)1, true); } public void Effects(Location loc, int particles, double velMult, Sound sound, diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java index 4a1cc4dea..47dff6950 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/command/MobCommand.java @@ -4,7 +4,7 @@ import java.util.HashMap; import java.util.HashSet; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; import org.bukkit.entity.Ageable; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java index ccd91287c..04d926714 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseManager.java @@ -5,25 +5,26 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import net.minecraft.server.v1_6_R3.ChunkAddEntityEvent; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet18ArmAnimation; -import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; -import net.minecraft.server.v1_6_R3.Packet28EntityVelocity; -import net.minecraft.server.v1_6_R3.Packet29DestroyEntity; -import net.minecraft.server.v1_6_R3.Packet31RelEntityMove; -import net.minecraft.server.v1_6_R3.Packet33RelEntityMoveLook; -import net.minecraft.server.v1_6_R3.Packet34EntityTeleport; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; -import net.minecraft.server.v1_6_R3.Packet44UpdateAttributes; -import net.minecraft.server.v1_6_R3.Packet5EntityEquipment; -import net.minecraft.server.v1_6_R3.Packet62NamedSoundEffect; +import net.minecraft.server.v1_7_R1.ChunkAddEntityEvent; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutAnimation; +import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityVelocity; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMove; +import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMoveLook; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_7_R1.PacketPlayOutUpdateAttributes; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment; +import net.minecraft.server.v1_7_R1.PacketPlayOutNamedSoundEffect; import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -42,16 +43,16 @@ import mineplex.core.disguise.disguises.DisguiseBlock; import mineplex.core.disguise.disguises.DisguiseInsentient; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.packethandler.IPacketRunnable; -import mineplex.core.packethandler.PacketArrayList; import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketVerifier; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; public class DisguiseManager extends MiniPlugin implements IPacketRunnable { private NautHashMap _spawnPacketMap = new NautHashMap(); - private NautHashMap _movePacketMap = new NautHashMap(); - private NautHashMap _moveTempMap = new NautHashMap(); + private NautHashMap _movePacketMap = new NautHashMap(); + private NautHashMap _moveTempMap = new NautHashMap(); private HashSet _goingUp = new HashSet(); private NautHashMap _entityDisguiseMap = new NautHashMap(); private NautHashMap _addTempList = new NautHashMap(); @@ -70,13 +71,13 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable try { - _attributesA = Packet44UpdateAttributes.class.getDeclaredField("a"); + _attributesA = PacketPlayOutUpdateAttributes.class.getDeclaredField("a"); _attributesA.setAccessible(true); - _soundB = Packet62NamedSoundEffect.class.getDeclaredField("b"); + _soundB = PacketPlayOutNamedSoundEffect.class.getDeclaredField("b"); _soundB.setAccessible(true); - _soundC = Packet62NamedSoundEffect.class.getDeclaredField("c"); + _soundC = PacketPlayOutNamedSoundEffect.class.getDeclaredField("c"); _soundC.setAccessible(true); - _soundD = Packet62NamedSoundEffect.class.getDeclaredField("d"); + _soundD = PacketPlayOutNamedSoundEffect.class.getDeclaredField("d"); _soundD.setAccessible(true); } catch (IllegalArgumentException e) @@ -124,7 +125,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable continue; EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(entity.getEntityId())); + entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(entity.getEntityId())); if (entity instanceof Player) { @@ -132,7 +133,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable } else { - entityPlayer.playerConnection.sendPacket(new Packet24MobSpawn(((CraftLivingEntity)entity).getHandle())); + entityPlayer.playerConnection.sendPacket(new PacketPlayOutSpawnEntityLiving(((CraftLivingEntity)entity).getHandle())); } } @@ -150,7 +151,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle(); - entityPlayer.playerConnection.sendPacket(new Packet29DestroyEntity(disguise.GetEntityId())); + entityPlayer.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(disguise.GetEntityId())); } List tempArmor = new ArrayList(); @@ -240,7 +241,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable continue; if (otherPlayer.getLocation().subtract(0, .5, 0).getBlock().getTypeId() != 0) - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet34EntityTeleport(((CraftPlayer)otherPlayer).getHandle())); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityTeleport(((CraftPlayer)otherPlayer).getHandle())); } } } @@ -263,35 +264,35 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable } @Override - public boolean run(Packet packet, Player owner, final PacketArrayList packetList) + public boolean run(final Packet packet, Player owner, final PacketVerifier packetList) { - if (packet instanceof Packet20NamedEntitySpawn) + if (packet instanceof PacketPlayOutNamedEntitySpawn) { - int entityId = ((Packet20NamedEntitySpawn)packet).a; + int entityId = ((PacketPlayOutNamedEntitySpawn)packet).a; if (_spawnPacketMap.containsKey(entityId)) { - packetList.forceAdd(_spawnPacketMap.get(entityId).GetSpawnPacket()); + packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket()); return false; } } - else if (packet instanceof Packet24MobSpawn) + else if (packet instanceof PacketPlayOutSpawnEntity) { - int entityId = ((Packet24MobSpawn)packet).a; + int entityId = ((PacketPlayOutSpawnEntity)packet).a; if (_spawnPacketMap.containsKey(entityId)) { - packetList.forceAdd(_spawnPacketMap.get(entityId).GetSpawnPacket()); + packetList.forceProcess(_spawnPacketMap.get(entityId).GetSpawnPacket()); return false; } } - else if (packet instanceof Packet44UpdateAttributes) + else if (packet instanceof PacketPlayOutUpdateAttributes) { int entityId = -1; try { - entityId = (int)_attributesA.get((Packet44UpdateAttributes)packet); + entityId = (int)_attributesA.get((PacketPlayOutUpdateAttributes)packet); } catch (IllegalArgumentException e) { @@ -309,40 +310,40 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable return false; } } - else if (packet instanceof Packet18ArmAnimation) + else if (packet instanceof PacketPlayOutAnimation) { - int entityId = ((Packet18ArmAnimation)packet).a; + int entityId = ((PacketPlayOutAnimation)packet).a; if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId) { return false; } } - else if (packet instanceof Packet40EntityMetadata) + else if (packet instanceof PacketPlayOutEntityMetadata) { - int entityId = ((Packet40EntityMetadata)packet).a; + int entityId = ((PacketPlayOutEntityMetadata)packet).a; if (_spawnPacketMap.containsKey(entityId) && owner.getEntityId() != entityId) { - packetList.forceAdd(_spawnPacketMap.get(entityId).GetMetaDataPacket()); + packetList.forceProcess(_spawnPacketMap.get(entityId).GetMetaDataPacket()); return false; } } - else if (packet instanceof Packet5EntityEquipment) + else if (packet instanceof PacketPlayOutEntityEquipment) { - int entityId = ((Packet5EntityEquipment)packet).a; + int entityId = ((PacketPlayOutEntityEquipment)packet).a; if (_spawnPacketMap.containsKey(entityId) && _spawnPacketMap.get(entityId) instanceof DisguiseInsentient) { - if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((Packet5EntityEquipment)packet).b != 0) + if (!((DisguiseInsentient)_spawnPacketMap.get(entityId)).armorVisible() && ((PacketPlayOutEntityEquipment)packet).b != 0) { return false; } } } - else if (packet instanceof Packet28EntityVelocity) + else if (packet instanceof PacketPlayOutEntityVelocity) { - Packet28EntityVelocity velocityPacket = (Packet28EntityVelocity)packet; + PacketPlayOutEntityVelocity velocityPacket = (PacketPlayOutEntityVelocity)packet; // Only for viewers if (velocityPacket.a == owner.getEntityId()) @@ -359,9 +360,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable return false; } } - else if (packet instanceof Packet31RelEntityMove) + else if (packet instanceof PacketPlayOutRelEntityMove) { - final Packet31RelEntityMove movePacket = (Packet31RelEntityMove)packet; + final PacketPlayOutRelEntityMove movePacket = (PacketPlayOutRelEntityMove)packet; // Only for viewers if (movePacket.a == owner.getEntityId()) @@ -376,7 +377,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable if (!_spawnPacketMap.containsKey(movePacket.a)) return true; - final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity(); + final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(); velocityPacket.a = movePacket.a; velocityPacket.b = movePacket.b * 100; velocityPacket.c = movePacket.c * 100; @@ -384,7 +385,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable if (_movePacketMap.containsKey(movePacket.a)) { - Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); + PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); velocityPacket.b = (int) (.8 * lastVelocityPacket.b); velocityPacket.c = (int) (.8 * lastVelocityPacket.c); @@ -393,7 +394,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable _movePacketMap.put(movePacket.a, velocityPacket); - packetList.forceAdd(velocityPacket); + packetList.forceProcess(velocityPacket); if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20) { @@ -401,7 +402,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable { public void run() { - packetList.forceAdd(velocityPacket); + packetList.forceProcess(velocityPacket); } }); } @@ -411,9 +412,9 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable } } - else if (packet instanceof Packet33RelEntityMoveLook) + else if (packet instanceof PacketPlayOutRelEntityMoveLook) { - final Packet33RelEntityMoveLook movePacket = (Packet33RelEntityMoveLook)packet; + final PacketPlayOutRelEntityMoveLook movePacket = (PacketPlayOutRelEntityMoveLook)packet; // Only for viewers if (movePacket.a == owner.getEntityId()) @@ -428,7 +429,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable if (!_spawnPacketMap.containsKey(movePacket.a)) return true; - final Packet28EntityVelocity velocityPacket = new Packet28EntityVelocity(); + final PacketPlayOutEntityVelocity velocityPacket = new PacketPlayOutEntityVelocity(); velocityPacket.a = movePacket.a; velocityPacket.b = movePacket.b * 100; velocityPacket.c = movePacket.c * 100; @@ -436,7 +437,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable if (_movePacketMap.containsKey(movePacket.a)) { - Packet28EntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); + PacketPlayOutEntityVelocity lastVelocityPacket = _movePacketMap.get(movePacket.a); velocityPacket.b = (int) (.8 * lastVelocityPacket.b); velocityPacket.c = (int) (.8 * lastVelocityPacket.c); @@ -445,7 +446,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable _movePacketMap.put(movePacket.a, velocityPacket); - packetList.forceAdd(velocityPacket); + packetList.forceProcess(velocityPacket); if (_goingUp.contains(movePacket.a) && movePacket.c != 0 && movePacket.c > 20) { @@ -453,18 +454,18 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable { public void run() { - packetList.forceAdd(velocityPacket); + packetList.forceProcess(velocityPacket); } }); } } - else if (packet instanceof Packet62NamedSoundEffect) + else if (packet instanceof PacketPlayOutNamedSoundEffect) { try { - int x = (int) _soundB.get((Packet62NamedSoundEffect)packet) / 8; - int y = (int) _soundC.get((Packet62NamedSoundEffect)packet) / 8; - int z = (int) _soundD.get((Packet62NamedSoundEffect)packet) / 8; + int x = (int) _soundB.get((PacketPlayOutNamedSoundEffect)packet) / 8; + int y = (int) _soundC.get((PacketPlayOutNamedSoundEffect)packet) / 8; + int z = (int) _soundD.get((PacketPlayOutNamedSoundEffect)packet) / 8; for (DisguiseBase disguise : _spawnPacketMap.values()) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java index 7f341c2eb..479d5f38f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java @@ -1,12 +1,13 @@ package mineplex.core.disguise.disguises; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; +import net.minecraft.server.v1_7_R1.DataWatcher; +import net.minecraft.server.v1_7_R1.Entity; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata; public abstract class DisguiseBase { @@ -18,7 +19,7 @@ public abstract class DisguiseBase public DisguiseBase(org.bukkit.entity.Entity entity) { Entity = ((CraftEntity)entity).getHandle(); - DataWatcher = new DataWatcher(); + DataWatcher = new DataWatcher(new DummyEntity(((CraftWorld)entity.getWorld()).getHandle())); DataWatcher.a(0, Byte.valueOf((byte)0)); DataWatcher.a(1, Short.valueOf((short)300)); @@ -42,7 +43,7 @@ public abstract class DisguiseBase public Packet GetMetaDataPacket() { UpdateDataWatcher(); - return new Packet40EntityMetadata(Entity.id, DataWatcher, true); + return new PacketPlayOutEntityMetadata(Entity.getId(), DataWatcher, true); } public void setSoundDisguise(DisguiseBase soundDisguise) @@ -75,7 +76,7 @@ public abstract class DisguiseBase public int GetEntityId() { - return Entity.id; + return Entity.getId(); } protected abstract String getHurtSound(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java index f8c6fb266..bde943afd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBlock.java @@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises; import java.util.Random; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity; public class DisguiseBlock extends DisguiseBase { @@ -34,8 +34,8 @@ public class DisguiseBlock extends DisguiseBase @Override public Packet GetSpawnPacket() { - Packet23VehicleSpawn packet = new Packet23VehicleSpawn(); - packet.a = Entity.id; + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(); + packet.a = Entity.getId(); packet.b = MathHelper.floor(Entity.locX * 32.0D); packet.c = MathHelper.floor(Entity.locY * 32.0D); packet.d = MathHelper.floor(Entity.locZ * 32.0D); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java index 54a5765d8..4f5c51660 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseCreature.java @@ -1,31 +1,23 @@ package mineplex.core.disguise.disguises; -import java.lang.reflect.Field; - -import net.minecraft.server.v1_6_R3.EnumEntitySize; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; +import net.minecraft.server.v1_7_R1.EnumEntitySize; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; public abstract class DisguiseCreature extends DisguiseInsentient { - private static Field _spawnDataWatcherField; - private static Field _spawnListField; - public DisguiseCreature(org.bukkit.entity.Entity entity) { super(entity); - - SetSpawnDataWatcherField(); - SetSpawnListField(); } protected abstract int GetEntityTypeId(); public Packet GetSpawnPacket() { - Packet24MobSpawn packet = new Packet24MobSpawn(); - packet.a = Entity.id; + PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); + packet.a = Entity.getId(); packet.b = (byte) GetEntityTypeId(); packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); @@ -73,72 +65,9 @@ public abstract class DisguiseCreature extends DisguiseInsentient packet.g = (int)(var6 * 8000.0D); packet.h = (int)(var8 * 8000.0D); - try - { - _spawnDataWatcherField.set(packet, DataWatcher); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } - - try - { - _spawnListField.set(packet, DataWatcher.b()); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } + packet.l = DataWatcher; + packet.m = DataWatcher.b(); return packet; } - - private void SetSpawnListField() - { - if (_spawnListField == null) - { - try - { - _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); - _spawnListField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } - - private void SetSpawnDataWatcherField() - { - if (_spawnDataWatcherField == null) - { - try - { - _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); - _spawnDataWatcherField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java index 7f4122fd3..43cea8843 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java @@ -2,9 +2,9 @@ package mineplex.core.disguise.disguises; import java.util.Arrays; -import net.minecraft.server.v1_6_R3.MobEffect; -import net.minecraft.server.v1_6_R3.MobEffectList; -import net.minecraft.server.v1_6_R3.PotionBrewer; +import net.minecraft.server.v1_7_R1.MobEffect; +import net.minecraft.server.v1_7_R1.MobEffectList; +import net.minecraft.server.v1_7_R1.PotionBrewer; public class DisguiseEnderman extends DisguiseMonster { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java index e79e1e66c..276e8525c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseInsentient.java @@ -3,8 +3,8 @@ package mineplex.core.disguise.disguises; import java.util.ArrayList; import java.util.List; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet5EntityEquipment; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityEquipment; public abstract class DisguiseInsentient extends DisguiseLiving { @@ -55,16 +55,16 @@ public abstract class DisguiseInsentient extends DisguiseLiving public List getArmorPackets() { - List p5 = new ArrayList(); - net.minecraft.server.v1_6_R3.ItemStack[] armorContents = Entity.getEquipment(); + List p5 = new ArrayList(); + net.minecraft.server.v1_7_R1.ItemStack[] armorContents = Entity.getEquipment(); for (short i=0; i < armorContents.length; i++) { - net.minecraft.server.v1_6_R3.ItemStack armorSlot = armorContents[i]; + net.minecraft.server.v1_7_R1.ItemStack armorSlot = armorContents[i]; if (armorSlot != null) { - p5.add(new Packet5EntityEquipment(Entity.id, i, armorSlot)); + p5.add(new PacketPlayOutEntityEquipment(Entity.getId(), i, armorSlot)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java index 1074c0690..6e9781144 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseMagmaCube.java @@ -1,25 +1,17 @@ package mineplex.core.disguise.disguises; -import java.lang.reflect.Field; - -import net.minecraft.server.v1_6_R3.EnumEntitySize; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; +import net.minecraft.server.v1_7_R1.EnumEntitySize; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; public class DisguiseMagmaCube extends DisguiseInsentient { - private static Field _spawnDataWatcherField; - private static Field _spawnListField; - public DisguiseMagmaCube(org.bukkit.entity.Entity entity) { super(entity); DataWatcher.a(16, new Byte((byte)1)); - - SetSpawnDataWatcherField(); - SetSpawnListField(); } public void SetSize(int i) @@ -34,8 +26,8 @@ public class DisguiseMagmaCube extends DisguiseInsentient public Packet GetSpawnPacket() { - Packet24MobSpawn packet = new Packet24MobSpawn(); - packet.a = Entity.id; + PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); + packet.a = Entity.getId(); packet.b = (byte) 62; packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); @@ -83,75 +75,12 @@ public class DisguiseMagmaCube extends DisguiseInsentient packet.g = (int)(var6 * 8000.0D); packet.h = (int)(var8 * 8000.0D); - try - { - _spawnDataWatcherField.set(packet, DataWatcher); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } - - try - { - _spawnListField.set(packet, DataWatcher.b()); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } + packet.l = DataWatcher; + packet.m = DataWatcher.b(); return packet; } - private void SetSpawnListField() - { - if (_spawnListField == null) - { - try - { - _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); - _spawnListField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } - - private void SetSpawnDataWatcherField() - { - if (_spawnDataWatcherField == null) - { - try - { - _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); - _spawnDataWatcherField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } - protected String getHurtSound() { return "mob.slime." + (GetSize() > 1 ? "big" : "small"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePig.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePig.java index 762be67d1..281450a83 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePig.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePig.java @@ -15,6 +15,6 @@ public class DisguisePig extends DisguiseAnimal public String getHurtSound() { - return "mob.pig.hurt"; + return "mob.pig.say"; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index d38b6e218..6d2694ba2 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -1,15 +1,12 @@ package mineplex.core.disguise.disguises; -import java.lang.reflect.Field; - -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.util.com.mojang.authlib.GameProfile; public class DisguisePlayer extends DisguiseHuman { - private static Field _spawnDataWatcherField; - private String _name; public DisguisePlayer(org.bukkit.entity.Entity entity, String name) @@ -22,55 +19,21 @@ public class DisguisePlayer extends DisguiseHuman } _name = name; - - SetSpawnDataWatcherField(); } @Override public Packet GetSpawnPacket() { - Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(); - packet.a = Entity.id; - packet.b = _name; + PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(); + packet.a = Entity.getId(); + packet.b = new GameProfile("1", _name); packet.c = MathHelper.floor(Entity.locX * 32.0D); packet.d = MathHelper.floor(Entity.locY * 32.0D); packet.e = MathHelper.floor(Entity.locZ * 32.0D); packet.f = (byte) ((int) (Entity.yaw * 256.0F / 360.0F)); packet.g = (byte) ((int) (Entity.pitch * 256.0F / 360.0F)); - - try - { - _spawnDataWatcherField.set(packet, DataWatcher); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } + packet.i = DataWatcher; return packet; } - - private void SetSpawnDataWatcherField() - { - if (_spawnDataWatcherField == null) - { - try - { - _spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i"); - _spawnDataWatcherField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java index a96b92730..0dd9ffce3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSlime.java @@ -1,25 +1,17 @@ package mineplex.core.disguise.disguises; -import java.lang.reflect.Field; - -import net.minecraft.server.v1_6_R3.EnumEntitySize; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; +import net.minecraft.server.v1_7_R1.EnumEntitySize; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; public class DisguiseSlime extends DisguiseInsentient { - private static Field _spawnDataWatcherField; - private static Field _spawnListField; - public DisguiseSlime(org.bukkit.entity.Entity entity) { super(entity); DataWatcher.a(16, new Byte((byte)1)); - - SetSpawnDataWatcherField(); - SetSpawnListField(); } public void SetSize(int i) @@ -34,8 +26,8 @@ public class DisguiseSlime extends DisguiseInsentient public Packet GetSpawnPacket() { - Packet24MobSpawn packet = new Packet24MobSpawn(); - packet.a = Entity.id; + PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); + packet.a = Entity.getId(); packet.b = (byte) 55; packet.c = (int)EnumEntitySize.SIZE_2.a(Entity.locX); packet.d = (int)MathHelper.floor(Entity.locY * 32.0D); @@ -82,76 +74,12 @@ public class DisguiseSlime extends DisguiseInsentient packet.f = (int)(var4 * 8000.0D); packet.g = (int)(var6 * 8000.0D); packet.h = (int)(var8 * 8000.0D); - - try - { - _spawnDataWatcherField.set(packet, DataWatcher); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } - - try - { - _spawnListField.set(packet, DataWatcher.b()); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } + packet.l = DataWatcher; + packet.m = DataWatcher.b(); return packet; } - private void SetSpawnListField() - { - if (_spawnListField == null) - { - try - { - _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); - _spawnListField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } - - private void SetSpawnDataWatcherField() - { - if (_spawnDataWatcherField == null) - { - try - { - _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); - _spawnDataWatcherField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - } - } - protected String getHurtSound() { return "mob.slime." + (GetSize() > 1 ? "big" : "small"); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSquid.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSquid.java index 30d075c75..2408f6d6f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSquid.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseSquid.java @@ -34,7 +34,7 @@ public class DisguiseSquid extends DisguiseMonster protected String getHurtSound() { - return null; + return "damage.hit"; } protected float getVolume() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java index dc22a9953..581ba4280 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseWolf.java @@ -1,6 +1,6 @@ package mineplex.core.disguise.disguises; -import net.minecraft.server.v1_6_R3.BlockCloth; +import net.minecraft.server.v1_7_R1.BlockCloth; public class DisguiseWolf extends DisguiseTameableAnimal { @@ -10,7 +10,7 @@ public class DisguiseWolf extends DisguiseTameableAnimal DataWatcher.a(18, new Float(20F)); DataWatcher.a(19, new Byte((byte)0)); - DataWatcher.a(20, new Byte((byte)BlockCloth.j_(1))); + DataWatcher.a(20, new Byte((byte)BlockCloth.b(1))); } public boolean isAngry() diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DummyEntity.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DummyEntity.java new file mode 100644 index 000000000..504c2b341 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DummyEntity.java @@ -0,0 +1,28 @@ +package mineplex.core.disguise.disguises; + +import net.minecraft.server.v1_7_R1.Entity; +import net.minecraft.server.v1_7_R1.NBTTagCompound; +import net.minecraft.server.v1_7_R1.World; + +public class DummyEntity extends Entity +{ + public DummyEntity(World world) + { + super(world); + } + + @Override + protected void c() + { + } + + @Override + protected void a(NBTTagCompound nbttagcompound) + { + } + + @Override + protected void b(NBTTagCompound nbttagcompound) + { + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java index d933f7287..1b5ac8e4b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntity.java @@ -2,17 +2,22 @@ package mineplex.core.fakeEntity; import java.lang.reflect.Field; -import net.minecraft.server.v1_6_R3.BlockCloth; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.EnumEntitySize; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; -import net.minecraft.server.v1_6_R3.Packet29DestroyEntity; -import net.minecraft.server.v1_6_R3.Packet39AttachEntity; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; +import net.minecraft.server.v1_7_R1.BlockCloth; +import net.minecraft.server.v1_7_R1.DataWatcher; +import net.minecraft.server.v1_7_R1.Entity; +import net.minecraft.server.v1_7_R1.EntityLiving; +import net.minecraft.server.v1_7_R1.EntitySlime; +import net.minecraft.server.v1_7_R1.EnumEntitySize; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_7_R1.PacketPlayOutAttachEntity; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata; +import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; import org.bukkit.entity.EntityType; public class FakeEntity @@ -63,15 +68,12 @@ public class FakeEntity public Packet Destroy() { - Packet29DestroyEntity packet = new Packet29DestroyEntity(); - packet.a = new int[] { GetEntityId() }; - - return packet; + return new PacketPlayOutEntityDestroy(new int[] { GetEntityId() }); } public Packet Spawn(int id) { - Packet24MobSpawn packet = new Packet24MobSpawn(); + PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); packet.a = id; packet.b = (byte) _entityType.getTypeId(); packet.c = (int)EnumEntitySize.SIZE_2.a(_location.getX()); @@ -119,8 +121,8 @@ public class FakeEntity packet.f = (int)(var4 * 8000.0D); packet.g = (int)(var6 * 8000.0D); packet.h = (int)(var8 * 8000.0D); - - DataWatcher dataWatcher = new DataWatcher(); + + DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle())); UpdateDataWatcher(dataWatcher); @@ -160,27 +162,27 @@ public class FakeEntity public Packet Hide(int entityId) { - DataWatcher dataWatcher = new DataWatcher(); + DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle())); UpdateDataWatcher(dataWatcher); dataWatcher.watch(0, Byte.valueOf((byte) 32)); - return new Packet40EntityMetadata(entityId, dataWatcher, false); + return new PacketPlayOutEntityMetadata(entityId, dataWatcher, false); } public Packet Show() { - DataWatcher dataWatcher = new DataWatcher(); + DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle())); UpdateDataWatcher(dataWatcher); - return new Packet40EntityMetadata(_entityId, dataWatcher, true); + return new PacketPlayOutEntityMetadata(_entityId, dataWatcher, true); } public Packet SetVehicle(int vehicleId) { - Packet39AttachEntity vehiclePacket = new Packet39AttachEntity(); + PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity(); vehiclePacket.a = 0; vehiclePacket.b = _entityId; vehiclePacket.c = vehicleId; @@ -195,7 +197,7 @@ public class FakeEntity public Packet SetPassenger(int passengerId, int entityId) { - Packet39AttachEntity vehiclePacket = new Packet39AttachEntity(); + PacketPlayOutAttachEntity vehiclePacket = new PacketPlayOutAttachEntity(); vehiclePacket.a = 0; vehiclePacket.b = passengerId; vehiclePacket.c = entityId; @@ -244,7 +246,7 @@ public class FakeEntity case WOLF: dataWatcher.a(18, new Integer(20)); dataWatcher.a(19, new Byte((byte) 0)); - dataWatcher.a(20, new Byte((byte) BlockCloth.j_(1))); + dataWatcher.a(20, new Byte((byte) BlockCloth.b(1))); case SKELETON: dataWatcher.a(13, new Byte((byte) 0)); break; @@ -277,17 +279,15 @@ public class FakeEntity { try { - _spawnListField = Packet24MobSpawn.class.getDeclaredField("u"); + _spawnListField = PacketPlayOutSpawnEntityLiving.class.getDeclaredField("m"); _spawnListField.setAccessible(true); } catch (NoSuchFieldException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -299,19 +299,17 @@ public class FakeEntity { try { - _spawnDataWatcherField = Packet24MobSpawn.class.getDeclaredField("t"); + _spawnDataWatcherField = PacketPlayOutSpawnEntityLiving.class.getDeclaredField("l"); _spawnDataWatcherField.setAccessible(true); } catch (NoSuchFieldException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java index a5bb45309..115758d13 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeEntityManager.java @@ -3,9 +3,9 @@ package mineplex.core.fakeEntity; import java.util.ArrayList; import java.util.List; -import net.minecraft.server.v1_6_R3.Packet; +import net.minecraft.server.v1_7_R1.Packet; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java index 80face9c7..11dfa615f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeFallingBlock.java @@ -1,9 +1,9 @@ package mineplex.core.fakeEntity; -import net.minecraft.server.v1_6_R3.EnumEntitySize; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn; +import net.minecraft.server.v1_7_R1.EnumEntitySize; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity; import org.bukkit.Location; import org.bukkit.entity.EntityType; @@ -23,7 +23,7 @@ public class FakeFallingBlock extends FakeEntity public Packet Spawn(int id) { - Packet23VehicleSpawn packet = new Packet23VehicleSpawn(); + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(); packet.a = id; packet.b = (int)EnumEntitySize.SIZE_2.a(GetLocation().getX()); packet.c = (int)MathHelper.floor(GetLocation().getY() * 32.0D); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java index 94b0f8e1e..47f88caac 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakeItemDrop.java @@ -1,13 +1,13 @@ package mineplex.core.fakeEntity; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn; +import net.minecraft.server.v1_7_R1.DataWatcher; +import net.minecraft.server.v1_7_R1.ItemStack; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntity; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.entity.EntityType; public class FakeItemDrop extends FakeEntity @@ -23,7 +23,7 @@ public class FakeItemDrop extends FakeEntity public Packet Spawn() { - Packet23VehicleSpawn packet = new Packet23VehicleSpawn(); + PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(); packet.a = GetEntityId(); packet.b = MathHelper.floor(GetLocation().getX() * 32.0D); packet.c = MathHelper.floor(GetLocation().getY() * 32.0D); @@ -75,7 +75,7 @@ public class FakeItemDrop extends FakeEntity dataWatcher.a(1, Short.valueOf((short)300)); dataWatcher.a(8, Integer.valueOf(0)); dataWatcher.a(9, Byte.valueOf((byte) 0)); - dataWatcher.a(10, new net.minecraft.server.v1_6_R3.ItemStack(_itemStack.getItem(), _itemStack.count)); + dataWatcher.a(10, new net.minecraft.server.v1_7_R1.ItemStack(_itemStack.getItem(), _itemStack.count)); } public void SetItemStack(org.bukkit.inventory.ItemStack itemStack) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java index 4dcc22092..ad958fb57 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/fakeEntity/FakePlayer.java @@ -2,12 +2,16 @@ package mineplex.core.fakeEntity; import java.lang.reflect.Field; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn; +import net.minecraft.server.v1_7_R1.DataWatcher; +import net.minecraft.server.v1_7_R1.EntitySlime; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutNamedEntitySpawn; +import net.minecraft.util.com.mojang.authlib.GameProfile; +import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; import org.bukkit.entity.EntityType; public class FakePlayer extends FakeEntity @@ -21,55 +25,25 @@ public class FakePlayer extends FakeEntity super(EntityType.PLAYER, location); _name = name; - - if (_spawnDataWatcherField == null) - { - try - { - _spawnDataWatcherField = Packet20NamedEntitySpawn.class.getDeclaredField("i"); - _spawnDataWatcherField.setAccessible(true); - } - catch (NoSuchFieldException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - catch (SecurityException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } } public Packet Spawn(int id) { - Packet20NamedEntitySpawn packet = new Packet20NamedEntitySpawn(); + PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn(); packet.a = id; - packet.b = _name; + packet.b = new GameProfile("1", _name); packet.c = MathHelper.floor(GetLocation().getX() * 32.0D); packet.d = MathHelper.floor(GetLocation().getY() * 32.0D); packet.e = MathHelper.floor(GetLocation().getZ() * 32.0D); packet.f = (byte) ((int) (GetLocation().getYaw() * 256.0F / 360.0F)); packet.g = (byte) ((int) (GetLocation().getPitch() * 256.0F / 360.0F)); - DataWatcher dataWatcher = new DataWatcher(); + DataWatcher dataWatcher = new DataWatcher(new EntitySlime(((CraftWorld)Bukkit.getWorlds().get(0)).getHandle())); UpdateDataWatcher(dataWatcher); - try - { - _spawnDataWatcherField.set(packet, dataWatcher); - } - catch (IllegalArgumentException e) - { - e.printStackTrace(); - } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } - + packet.i = dataWatcher; + return packet; } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index 194b12468..a7cf5439f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -16,7 +16,7 @@ import mineplex.core.common.util.UtilTime; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/join/JoinQuit.java b/Plugins/Mineplex.Core/src/mineplex/core/join/JoinQuit.java new file mode 100644 index 000000000..eb6ba04f7 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/join/JoinQuit.java @@ -0,0 +1,22 @@ +package mineplex.core.join; + +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.util.F; + +public class JoinQuit +{ + @EventHandler + public void Join(PlayerJoinEvent event) + { + event.setJoinMessage(F.sys("Join", event.getPlayer().getName())); + } + + @EventHandler + public void Quit(PlayerQuitEvent event) + { + event.setQuitMessage(F.sys("Quit", event.getPlayer().getName())); + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java index f9f2b80ff..d338a9d0f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/memory/MemoryFix.java @@ -2,12 +2,12 @@ package mineplex.core.memory; import java.util.Iterator; -import net.minecraft.server.v1_6_R3.IInventory; +import net.minecraft.server.v1_7_R1.IInventory; import org.bukkit.Bukkit; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.HumanEntity; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java index ef26505a7..09f6b46ae 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/movement/Movement.java @@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java index 927d8fc29..2084748d5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcEntry.java @@ -1,9 +1,9 @@ package mineplex.core.npc; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.entity.Entity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.Location; public class NpcEntry diff --git a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java index 78fcfe366..ce648f03b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/npc/NpcManager.java @@ -11,15 +11,15 @@ import java.util.HashSet; import java.util.Iterator; import java.util.UUID; -import net.minecraft.server.v1_6_R3.EntityAgeable; -import net.minecraft.server.v1_6_R3.EntityInsentient; +import net.minecraft.server.v1_7_R1.EntityAgeable; +import net.minecraft.server.v1_7_R1.EntityInsentient; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World.Environment; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftAgeable; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftAgeable; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java index 2b1b8fab5..175cd4cc3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/IPacketRunnable.java @@ -2,9 +2,9 @@ package mineplex.core.packethandler; import org.bukkit.entity.Player; -import net.minecraft.server.v1_6_R3.Packet; +import net.minecraft.server.v1_7_R1.Packet; public interface IPacketRunnable { - boolean run(Packet packet, Player owner, PacketArrayList packetList); + boolean run(Packet packet, Player owner, PacketVerifier packetList); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketArrayList.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketArrayList.java deleted file mode 100644 index b40a4275a..000000000 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketArrayList.java +++ /dev/null @@ -1,161 +0,0 @@ -package mineplex.core.packethandler; - -import java.lang.reflect.Field; -import java.util.ArrayList; - -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet28EntityVelocity; -import net.minecraft.server.v1_6_R3.Packet31RelEntityMove; -import net.minecraft.server.v1_6_R3.Packet33RelEntityMoveLook; -import net.minecraft.server.v1_6_R3.Packet34EntityTeleport; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; - -import org.bukkit.entity.Player; - -public class PacketArrayList extends ArrayList -{ - private static final long serialVersionUID = 1L; - private Player _owner; - private PacketHandler _handler; - private Field _packet40Metadata; - - public PacketArrayList(Player owner, PacketHandler handler) - { - _owner = owner; - _handler = handler; - - try - { - _packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b"); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - - _packet40Metadata.setAccessible(true); - } - - @Override - public boolean add(Packet o) - { - /* - else if (o instanceof Packet201PlayerInfo) - { - if (!_handler.IsTracked((Packet201PlayerInfo)o)) - return false; - //if (( && _packetHandler.IsPlayerTracked(((Packet201PlayerInfo)o).a) ) - //{ - // return false; - //} - } - else if (o instanceof Packet40EntityMetadata) - { - List objects = null; - try - { - objects = (List)_packet40Metadata.get(((Packet40EntityMetadata)o)); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - System.out.println("Packet40EntityMetadata for " + ((Packet40EntityMetadata)o).a); - - if (objects != null) - { - for (WatchableObject watched : objects) - { - System.out.println("a(" + watched.a() + ", " + watched.b() + ") " + GetDataType(watched.c())); - } - } - - System.out.println("End Packet40EntityMetadata"); - } - */ - if (o instanceof Packet34EntityTeleport) - { - Packet34EntityTeleport packet = (Packet34EntityTeleport)o; - - //System.out.println("Packet34EntityTeleport (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); - - if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) - { - return super.add(new Packet34EntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f)); - } - else if (_handler.IsBlocked(_owner, packet.a)) - return false; - } - else if (o instanceof Packet28EntityVelocity) - { - Packet28EntityVelocity packet = (Packet28EntityVelocity)o; - - //System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ") for " + packet.a + " to " + _owner.getName()); - - if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) - { - // Occasional velocity sent for player in MK jacks up karts so don't process this. - return false; - } - else if (_handler.IsBlocked(_owner, packet.a)) - return false; - } - else if (o instanceof Packet31RelEntityMove) - { - Packet31RelEntityMove packet = (Packet31RelEntityMove)o; - - //System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); - - if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) - { - return super.add(new Packet31RelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d)); - } - else if (_handler.IsBlocked(_owner, packet.a)) - return false; - } - else if (o instanceof Packet33RelEntityMoveLook) - { - Packet33RelEntityMoveLook packet = (Packet33RelEntityMoveLook)o; - - //System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); - - if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) - { - return super.add(new Packet33RelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f)); - } - else if (_handler.IsBlocked(_owner, packet.a)) - return false; - } - /* - else if (!(o instanceof Packet206SetScoreboardObjective) && !(o instanceof Packet207SetScoreboardScore) && !(o instanceof Packet208SetScoreboardDisplayObjective) && !(o instanceof Packet56MapChunkBulk) && !(o instanceof Packet0KeepAlive) && !(o instanceof Packet4UpdateTime) && !(o instanceof Packet43SetExperience) && !(o instanceof Packet35EntityHeadRotation) && !(o instanceof Packet32EntityLook)) - { - System.out.println(o.getClass()); - } - */ - - if (_handler.FireRunnables(o, _owner, this)) - { - return forceAdd(o); - } - - return true; - } - - public boolean forceAdd(Packet packet) - { - return super.add(packet); - } - - public void Deactivate() - { - _owner = null; - _packet40Metadata = null; - } -} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index 8964fb9ed..a04b9d0fd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -1,18 +1,13 @@ package mineplex.core.packethandler; -import java.lang.reflect.Field; import java.util.ArrayList; -import java.util.Collections; import java.util.HashSet; -import java.util.List; -import java.util.logging.Level; import mineplex.core.MiniPlugin; import mineplex.core.common.util.NautHashMap; -import net.minecraft.server.v1_6_R3.NetworkManager; -import net.minecraft.server.v1_6_R3.Packet; +import net.minecraft.server.v1_7_R1.Packet; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -20,12 +15,8 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -@SuppressWarnings( { "rawtypes", "unchecked" } ) public class PacketHandler extends MiniPlugin { - private Field syncField; - private Field highField; - private NautHashMap> _forwardMap; private NautHashMap> _blockMap; private NautHashMap> _fakeVehicleMap; @@ -41,18 +32,6 @@ public class PacketHandler extends MiniPlugin _fakeVehicleMap = new NautHashMap>(); _fakePassengerMap = new NautHashMap>(); _packetRunnables = new ArrayList(); - - try - { - this.syncField = NetworkManager.class.getDeclaredField("h"); - this.syncField.setAccessible(true); - this.highField = NetworkManager.class.getDeclaredField("highPriorityQueue"); - this.highField.setAccessible(true); - } - catch (final Exception e) - { - System.out.println("Error initializing " + GetName() + " NetworkManager fields..."); - } } public String GetDataType(int c) @@ -141,27 +120,12 @@ public class PacketHandler extends MiniPlugin public void in(Player player) { - try - { - this.nom(this.getManager(player), Collections.synchronizedList(new PacketArrayList(player, this))); - - } - catch (final Exception e) - { - // new TagAPIException("[TagAPI] Failed to inject into networkmanager for " + player.getName(), e).printStackTrace(); - } + ((CraftPlayer) player).getHandle().playerConnection.PacketVerifier.addPacketVerifier(new PacketVerifier(player, this)); } public void out(Player player) { - try - { - this.nom(this.getManager(player), Collections.synchronizedList(new ArrayList()), true); - } - catch (final Exception e) - { - this._plugin.getLogger().log(Level.WARNING, "Failed to restore " + player.getName() + ". Could be a problem.", e); - } + ((CraftPlayer) player).getHandle().playerConnection.PacketVerifier.clearVerifiers(); } public void shutdown() @@ -175,48 +139,6 @@ public class PacketHandler extends MiniPlugin } } - private NetworkManager getManager(Player player) - { - return (NetworkManager) ((CraftPlayer) player).getHandle().playerConnection.networkManager; - } - - private void nom(NetworkManager nm, List list) throws IllegalArgumentException, IllegalAccessException - { - this.nom(nm, list, false); - } - - private void nom(NetworkManager nm, List list, boolean onlyIfOldIsHacked) throws IllegalArgumentException, IllegalAccessException - { - final List old = (List) this.highField.get(nm); - boolean copy = true; - - if (onlyIfOldIsHacked) - { - if (!(old instanceof PacketArrayList)) - { - return; - } - else - { - copy = false; - ((PacketArrayList)old).Deactivate(); - } - } - - synchronized (this.syncField.get(nm)) - { - if (copy) - { - for (final Object object : old) - { - list.add(object); - } - } - - this.highField.set(nm, list); - } - } - public void ForwardMovement(Player viewer, int travellerId, int entityId) { if (!_forwardMap.containsKey(viewer.getName())) @@ -278,7 +200,7 @@ public class PacketHandler extends MiniPlugin _forwardMap.remove(viewer.getName()); } - public boolean FireRunnables(Packet o, Player owner, PacketArrayList packetList) + public boolean FireRunnables(Packet o, Player owner, PacketVerifier packetList) { boolean addOriginal = true; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java new file mode 100644 index 000000000..92081cba1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketVerifier.java @@ -0,0 +1,97 @@ +package mineplex.core.packethandler; + +import net.minecraft.server.v1_7_R1.IPacketVerifier; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityVelocity; +import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMove; +import net.minecraft.server.v1_7_R1.PacketPlayOutRelEntityMoveLook; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityTeleport; +import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; + +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; +import org.bukkit.entity.Player; + +public class PacketVerifier implements IPacketVerifier +{ + private Player _owner; + private PacketHandler _handler; + + public PacketVerifier(Player owner, PacketHandler handler) + { + _owner = owner; + _handler = handler; + } + + @Override + public boolean verify(Packet o) + { + if (o instanceof PacketPlayOutEntityTeleport) + { + PacketPlayOutEntityTeleport packet = (PacketPlayOutEntityTeleport)o; + + //System.out.println("Packet34EntityTeleport (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + forceProcess(new PacketPlayOutEntityTeleport(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f)); + return true; + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + else if (o instanceof PacketPlayOutEntityVelocity) + { + PacketPlayOutEntityVelocity packet = (PacketPlayOutEntityVelocity)o; + + //System.out.println("Packet28EntityVelocity (" + packet.b / 8000.0D + ", " + packet.c / 8000.0D + ", " + packet.d / 8000.0D + ") for " + packet.a + " to " + _owner.getName()); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + // Occasional velocity sent for player in MK jacks up karts so don't process this. + return false; + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + else if (o instanceof PacketPlayOutRelEntityMove) + { + PacketPlayOutRelEntityMove packet = (PacketPlayOutRelEntityMove)o; + + //System.out.println("Packet31RelEntityMove (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + forceProcess(new PacketPlayOutRelEntityMove(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d)); + return true; + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + else if (o instanceof PacketPlayOutRelEntityMoveLook) + { + PacketPlayOutRelEntityMoveLook packet = (PacketPlayOutRelEntityMoveLook)o; + + //System.out.println("Packet33RelEntityMoveLook (" + packet.b + ", " + packet.c + ", " + packet.d + ")"); + + if (_handler.IsForwarding(_owner) && _handler.IsForwarded(_owner, packet.a)) + { + forceProcess(new PacketPlayOutRelEntityMoveLook(_handler.GetForwardId(_owner, packet.a), packet.b, packet.c, packet.d, packet.e, packet.f)); + return true; + } + else if (_handler.IsBlocked(_owner, packet.a)) + return false; + } + + return _handler.FireRunnables(o, _owner, this); + } + + public void forceProcess(Packet packet) + { + ((CraftPlayer)_owner).getHandle().playerConnection.networkManager.handle(packet, new GenericFutureListener[0]); + } + + public void Deactivate() + { + _owner = null; + } +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java index 3540e18de..b62a8ccf7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/PetManager.java @@ -16,13 +16,14 @@ import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilInv; import mineplex.core.donation.DonationManager; import mineplex.core.itemstack.ItemStackFactory; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.Navigation; -import net.minecraft.server.v1_6_R3.PathfinderGoalLookAtPlayer; -import net.minecraft.server.v1_6_R3.PathfinderGoalRandomLookaround; -import net.minecraft.server.v1_6_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityHuman; +import net.minecraft.server.v1_7_R1.EntityInsentient; +import net.minecraft.server.v1_7_R1.Navigation; +import net.minecraft.server.v1_7_R1.PathfinderGoalLookAtPlayer; +import net.minecraft.server.v1_7_R1.PathfinderGoalRandomLookaround; +import net.minecraft.server.v1_7_R1.PathfinderGoalSelector; + @@ -32,8 +33,8 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.craftbukkit.libs.com.google.gson.Gson; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Ageable; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java index 189bdde0d..7e009691e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetPage.java @@ -4,13 +4,15 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.Packet100OpenWindow; -import net.minecraft.server.v1_6_R3.Packet103SetSlot; +import net.minecraft.server.v1_7_R1.Block; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Item; +import net.minecraft.server.v1_7_R1.Items; +import net.minecraft.server.v1_7_R1.PacketPlayOutOpenWindow; +import net.minecraft.server.v1_7_R1.PacketPlayOutSetSlot; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; @@ -110,11 +112,11 @@ public class PetPage extends ShopPageBase PetTagPage petTagPage = new PetTagPage(Plugin, Shop, ClientManager, DonationManager, "Repairing", Player, pet, petPurchase); EntityPlayer entityPlayer = ((CraftPlayer)Player).getHandle(); int containerCounter = entityPlayer.nextContainerCounter(); - entityPlayer.playerConnection.sendPacket(new Packet100OpenWindow(containerCounter, 8, "Repairing", 9, true)); + entityPlayer.playerConnection.sendPacket(new PacketPlayOutOpenWindow(containerCounter, 8, "Repairing", 9, true)); entityPlayer.activeContainer = new AnvilContainer(entityPlayer.inventory, petTagPage.getInventory()); entityPlayer.activeContainer.windowId = containerCounter; entityPlayer.activeContainer.addSlotListener(entityPlayer); - entityPlayer.playerConnection.sendPacket(new Packet103SetSlot(containerCounter, 0, new net.minecraft.server.v1_6_R3.ItemStack(Item.NAME_TAG))); + entityPlayer.playerConnection.sendPacket(new PacketPlayOutSetSlot(containerCounter, 0, new net.minecraft.server.v1_7_R1.ItemStack(Items.NAME_TAG))); Shop.SetCurrentPageForPlayer(Player, petTagPage); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java index c13dcd242..f17bd6531 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/pet/ui/PetTagPage.java @@ -14,8 +14,9 @@ import mineplex.core.pet.repository.token.PetChangeToken; import mineplex.core.pet.repository.token.PetToken; import mineplex.core.shop.page.ConfirmationPage; import mineplex.core.shop.page.ShopPageBase; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.ItemStack; +import net.minecraft.server.v1_7_R1.Item; +import net.minecraft.server.v1_7_R1.ItemStack; +import net.minecraft.server.v1_7_R1.Items; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -42,7 +43,7 @@ public class PetTagPage extends ShopPageBase @Override protected void BuildPage() { - inventory.setItem(0, new ItemStack(Item.NAME_TAG)); + inventory.setItem(0, new ItemStack(Items.NAME_TAG)); ButtonMap.put(0, new CloseButton()); ButtonMap.put(1, new CloseButton()); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java index 6ffb264ff..e7b679927 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/projectile/ProjectileUser.java @@ -14,7 +14,7 @@ import org.bukkit.GameMode; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; @@ -106,9 +106,9 @@ public class ProjectileUser { for (Object entity : ((CraftWorld)_thrown.getWorld()).getHandle().entityList) { - if (entity instanceof net.minecraft.server.v1_6_R3.Entity) + if (entity instanceof net.minecraft.server.v1_7_R1.Entity) { - Entity bukkitEntity = ((net.minecraft.server.v1_6_R3.Entity) entity).getBukkitEntity(); + Entity bukkitEntity = ((net.minecraft.server.v1_7_R1.Entity) entity).getBukkitEntity(); if (bukkitEntity instanceof LivingEntity) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java index 70ae38421..5fd20a919 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/punish/UI/PunishPage.java @@ -22,7 +22,7 @@ import mineplex.core.shop.item.ShopItem; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryCustom; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryCustom; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -390,7 +390,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener @EventHandler public void OnInventoryClick(InventoryClickEvent event) { - if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player) + if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getWhoClicked() == _player) { if (_buttonMap.containsKey(event.getRawSlot())) { @@ -407,7 +407,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener @EventHandler public void OnInventoryClose(InventoryCloseEvent event) { - if (inventory.getName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player) + if (inventory.getInventoryName().equalsIgnoreCase(event.getInventory().getTitle()) && event.getPlayer() == _player) { ClosePunish(); } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java index 15e543b3d..aa69b97bd 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/ShopBase.java @@ -151,7 +151,7 @@ public abstract class ShopBase implements Listene @EventHandler public void OnInventoryClose(InventoryCloseEvent event) { - if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) + if (PlayerPageMap.containsKey(event.getPlayer().getName()) && PlayerPageMap.get(event.getPlayer().getName()).getTitle() != null && PlayerPageMap.get(event.getPlayer().getName()).getTitle().equalsIgnoreCase(event.getInventory().getTitle())) { PlayerPageMap.get(event.getPlayer().getName()).PlayerClosed(); PlayerPageMap.get(event.getPlayer().getName()).Dispose(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java index a6dbfafb6..0686c4f4e 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ISalesPackage.java @@ -5,7 +5,7 @@ import java.util.List; import org.bukkit.entity.Player; import mineplex.core.account.CoreClient; -import net.minecraft.server.v1_6_R3.IInventory; +import net.minecraft.server.v1_7_R1.IInventory; public interface ISalesPackage { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java index b18f8b06d..2c3cfe0e5 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ItemPackage.java @@ -5,10 +5,10 @@ import java.util.List; import mineplex.core.account.CoreClient; import mineplex.core.common.util.InventoryUtil; -import net.minecraft.server.v1_6_R3.IInventory; +import net.minecraft.server.v1_7_R1.IInventory; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java index ec1683b9c..666fd2a8d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/item/ShopItem.java @@ -1,11 +1,11 @@ package mineplex.core.shop.item; -import net.minecraft.server.v1_6_R3.NBTTagList; -import net.minecraft.server.v1_6_R3.NBTTagString; +import net.minecraft.server.v1_7_R1.NBTTagList; +import net.minecraft.server.v1_7_R1.NBTTagString; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; public class ShopItem extends CraftItemStack @@ -66,8 +66,8 @@ public class ShopItem extends CraftItemStack UpdateVisual(false); // Fix for temp save junk(fixes problem when disconnecting and trying to return) - if (getHandle().tag != null) - getHandle().tag.setName("tag"); + //if (getHandle().tag != null) + // getHandle().tag.setName("tag"); getHandle().tag.setByte("Count", (byte)Math.max(deliveryAmount, 1)); getHandle().tag.set("AttributeModifiers", new NBTTagList()); @@ -100,8 +100,8 @@ public class ShopItem extends CraftItemStack return false; } - net.minecraft.server.v1_6_R3.ItemStack original = ((CraftItemStack)this).getHandle(); - net.minecraft.server.v1_6_R3.ItemStack comparison = ((CraftItemStack)obj).getHandle(); + net.minecraft.server.v1_7_R1.ItemStack original = ((CraftItemStack)this).getHandle(); + net.minecraft.server.v1_7_R1.ItemStack comparison = ((CraftItemStack)obj).getHandle(); return original.tag == null || original.tag.equals(comparison.tag); } @@ -120,14 +120,14 @@ public class ShopItem extends CraftItemStack } } - NBTTagList lore = new NBTTagList("Lore"); + NBTTagList lore = new NBTTagList(); if (_lore != null) { for (String line : _lore) { if (line != null && !line.isEmpty()) - lore.add(new NBTTagString("Test", line)); + lore.add(new NBTTagString(line)); } } @@ -159,14 +159,14 @@ public class ShopItem extends CraftItemStack { _lore = string; - NBTTagList lore = new NBTTagList("Lore"); + NBTTagList lore = new NBTTagList(); if (_lore != null) { for (String line : _lore) { if (line != null && !line.isEmpty()) - lore.add(new NBTTagString("Test", line)); + lore.add(new NBTTagString(line)); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java index d675eead6..7b9728cb6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/AnvilContainer.java @@ -1,16 +1,16 @@ package mineplex.core.shop.page; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryDoubleChest; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryPlayer; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryView; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryDoubleChest; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryPlayer; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryView; -import net.minecraft.server.v1_6_R3.Container; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.IInventory; -import net.minecraft.server.v1_6_R3.InventoryLargeChest; -import net.minecraft.server.v1_6_R3.PlayerInventory; -import net.minecraft.server.v1_6_R3.Slot; +import net.minecraft.server.v1_7_R1.Container; +import net.minecraft.server.v1_7_R1.EntityHuman; +import net.minecraft.server.v1_7_R1.IInventory; +import net.minecraft.server.v1_7_R1.InventoryLargeChest; +import net.minecraft.server.v1_7_R1.PlayerInventory; +import net.minecraft.server.v1_7_R1.Slot; public class AnvilContainer extends Container { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java index ced0363ab..ad0478ec0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/shop/page/ShopPageBase.java @@ -1,8 +1,8 @@ package mineplex.core.shop.page; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryCustom; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryCustom; import org.bukkit.entity.Player; import org.bukkit.event.Listener; import org.bukkit.event.inventory.InventoryClickEvent; diff --git a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java index d31d59c5f..bda582e9f 100644 --- a/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java +++ b/Plugins/Mineplex.EnjinTranslator/src/mineplex/enjinTranslator/Enjin.java @@ -10,8 +10,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.plugin.java.JavaPlugin; -import com.google.common.reflect.TypeToken; - import mineplex.core.MiniPlugin; import mineplex.core.account.CoreClientManager; import mineplex.core.donation.DonationManager; diff --git a/Plugins/Mineplex.Hub/.classpath b/Plugins/Mineplex.Hub/.classpath index a2e0729de..35469a6e0 100644 --- a/Plugins/Mineplex.Hub/.classpath +++ b/Plugins/Mineplex.Hub/.classpath @@ -10,5 +10,6 @@ + diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index a87a7eaab..7c9e46e3a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -8,7 +8,7 @@ import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; import org.bukkit.entity.Egg; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java index 7ae6375ac..d2252f480 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/StackerManager.java @@ -264,7 +264,7 @@ public class StackerManager extends MiniPlugin implements IThrown UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); //Portal Delay Manager.SetPortalDelay(target); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java index 642c406ba..576689553 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/VisibilityManager.java @@ -6,7 +6,7 @@ import java.util.HashSet; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonData.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonData.java index 24404cb79..35845b365 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonData.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/DragonData.java @@ -5,7 +5,7 @@ import mineplex.core.common.util.UtilEnt; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEnderDragon; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEnderDragon; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java index 2af7827f9..97c33884a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/mount/HorseMount.java @@ -8,12 +8,12 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Horse.Variant; import org.bukkit.entity.Horse; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java index 0b7d40318..fe34e10d0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/BackStab.java @@ -68,7 +68,7 @@ public class BackStab extends Skill event.AddMod(damager.getName(), GetName(), 1 + level, true); //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT, 1f, 2f); + damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f); return; } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java index 7ff8b3bc9..58140f499 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/MarkedForDeath.java @@ -75,7 +75,7 @@ public class MarkedForDeath extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler @@ -125,7 +125,7 @@ public class MarkedForDeath extends SkillActive if (level == 0) return; //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f); + damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); //Inform UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java index 19c020ee5..b9015eb1b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/SilencingArrow.java @@ -73,7 +73,7 @@ public class SilencingArrow extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler @@ -126,7 +126,7 @@ public class SilencingArrow extends SkillActive Factory.Condition().Factory().Silence(GetName(), damagee, damager, confuseDur, true, true); //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f); + damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); //Inform UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java index 0324cbe70..139f5d3e4 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Stealth.java @@ -107,7 +107,7 @@ public class Stealth extends Skill Factory.Condition().Factory().Vulnerable(GetName(), player, player, 120000, 3, false, true, true); //Sound - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 0.5f, 0.5f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 0.5f, 0.5f); } public void Remove(Player player, LivingEntity source) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java index c72bda119..e0549624b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/ToxicArrow.java @@ -73,7 +73,7 @@ public class ToxicArrow extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler @@ -126,7 +126,7 @@ public class ToxicArrow extends SkillActive Factory.Condition().Factory().Confuse(GetName(), damagee, damager, confuseDur, 0, true, true, true); //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2.5f, 2.0f); + damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); //Inform UtilPlayer.message(event.GetDamageePlayer(), F.main(GetClassType().name(), F.name(damager.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java index 2af21aaf6..3ae523c41 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/NullBlade.java @@ -56,7 +56,7 @@ public class NullBlade extends Skill event.AddMod(damager.getName(), GetName(), 0, true); //Effect - damager.getWorld().playSound(damager.getLocation(), Sound.BREATH, 0.6f, 0.6f); + damager.getWorld().playSound(damager.getLocation(), Sound.BLAZE_BREATH, 0.6f, 0.6f); } @Override diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java index 2e63870b3..82b97a7ca 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java @@ -117,7 +117,7 @@ public class Void extends Skill return; for (Player cur : _active) - cur.getWorld().playSound(cur.getLocation(), Sound.BREATH, 0.5f, 0.5f); + cur.getWorld().playSound(cur.getLocation(), Sound.BLAZE_BREATH, 0.5f, 0.5f); } @EventHandler @@ -173,7 +173,7 @@ public class Void extends Skill event.SetKnockback(false); //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.BREATH, 2f, 1f); + damagee.getWorld().playSound(damagee.getLocation(), Sound.BLAZE_BREATH, 2f, 1f); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java index 057ea4fbe..a49d363d4 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/HealingShot.java @@ -80,7 +80,7 @@ public class HealingShot extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java index dd12e6b36..05b55059a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/IncendiaryShot.java @@ -74,7 +74,7 @@ public class IncendiaryShot extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java index 222f984eb..30a1f9815 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java @@ -74,7 +74,7 @@ public class NapalmShot extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java index ce51541c0..a0ba339e5 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/RopedArrow.java @@ -68,7 +68,7 @@ public class RopedArrow extends SkillActive UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); //Effect - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 2.5f, 2.0f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler @@ -117,7 +117,7 @@ public class RopedArrow extends SkillActive 0.4 + mult, false, 0, 0.3 * mult, 1.2 * mult, true); //Effect - proj.getWorld().playSound(proj.getLocation(), Sound.BREATH, 2.5f, 2.0f); + proj.getWorld().playSound(proj.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); } @EventHandler diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java index 0c68e9a9b..cce33a012 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemFactory.java @@ -55,7 +55,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory try { - _itemMaxDurability = net.minecraft.server.v1_6_R3.Item.class.getDeclaredField("durability"); + _itemMaxDurability = net.minecraft.server.v1_7_R1.Item.class.getDeclaredField("durability"); _itemMaxDurability.setAccessible(true); } catch (SecurityException e) @@ -195,7 +195,7 @@ public class ItemFactory extends MiniPlugin implements IItemFactory try { - _itemMaxDurability.setInt(net.minecraft.server.v1_6_R3.Item.byId[newItem.GetType().getId()], 56); + _itemMaxDurability.setInt(net.minecraft.server.v1_7_R1.Item.d(newItem.GetType().getId()), 56); } catch (IllegalArgumentException e) { diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java index 21f67d83f..1e812f01f 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/ItemUsable.java @@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.item; import org.bukkit.Material; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java index c2422c582..d4ce9f4b1 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityExplosive.java @@ -7,7 +7,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java index 0ee46acb5..641578d64 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/ProximityZapper.java @@ -7,7 +7,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java index c817f6b9b..3333c20c0 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/item/Throwable/WaterBottle.java @@ -4,7 +4,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerInteractEvent; diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java index 06533825a..71c352eac 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassCombatShop.java @@ -1,6 +1,6 @@ package mineplex.minecraft.game.classcombat.shop; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index 40ab1efc3..4cb382a02 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -3,9 +3,9 @@ package mineplex.minecraft.game.core.combat; import java.util.HashSet; import java.util.Iterator; -import net.minecraft.server.v1_6_R3.ItemStack; +import net.minecraft.server.v1_7_R1.ItemStack; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.entity.Arrow; import org.bukkit.entity.Fireball; import org.bukkit.entity.LivingEntity; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java index e80c15a67..0995482ad 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/condition/ConditionEffect.java @@ -19,7 +19,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.potion.PotionEffectType; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; public class ConditionEffect implements Listener { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index 3a4bb6c0e..842eff340 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -17,15 +17,15 @@ import mineplex.core.disguise.DisguiseManager; import mineplex.core.npc.NpcManager; import mineplex.minecraft.game.core.combat.CombatManager; import mineplex.minecraft.game.core.damage.compatibility.NpcProtectListener; -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityLiving; +import net.minecraft.server.v1_7_R1.DamageSource; +import net.minecraft.server.v1_7_R1.EntityHuman; +import net.minecraft.server.v1_7_R1.EntityLiving; import org.bukkit.EntityEffect; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; import org.bukkit.entity.Fish; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -102,6 +102,7 @@ public class DamageManager extends MiniPlugin NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel); event.setCancelled(true); + System.out.println("Cancelled original"); } /* @@ -318,6 +319,7 @@ public class DamageManager extends MiniPlugin { EntityLiving entityDamagee = ((CraftLivingEntity)damagee).getHandle(); EntityLiving entityDamager = null; + if (damager != null) entityDamager= ((CraftLivingEntity)damager).getHandle(); @@ -330,6 +332,7 @@ public class DamageManager extends MiniPlugin return; } + System.out.println("Applying damage (" + (damage - entityDamagee.lastDamage) + ")"); ApplyDamage(entityDamagee, damage - entityDamagee.lastDamage, ignoreArmor); entityDamagee.lastDamage = damage; } @@ -338,6 +341,7 @@ public class DamageManager extends MiniPlugin entityDamagee.lastDamage = damage; entityDamagee.ax = entityDamagee.getHealth(); //entityDamagee.noDamageTicks = entityDamagee.maxNoDamageTicks; + System.out.println("Applying damage (" + (damage - entityDamagee.lastDamage) + ")"); ApplyDamage(entityDamagee, damage, ignoreArmor); //entityDamagee.hurtTicks = entityDamagee.aW = 10; } @@ -345,11 +349,12 @@ public class DamageManager extends MiniPlugin if (entityDamager != null) entityDamagee.b(entityDamager); - _lastDamageByPlayerTime.setInt(entityDamagee, 60); - if (entityDamager != null) if (entityDamager instanceof EntityHuman) + { + _lastDamageByPlayerTime.setInt(entityDamagee, 100); entityDamagee.killer = (EntityHuman)entityDamager; + } if (entityDamagee.getHealth() <= 0) { @@ -446,7 +451,7 @@ public class DamageManager extends MiniPlugin { if (!ignoreArmor) { - int j = 25 - entityLiving.aQ(); + int j = 25 - entityLiving.aV(); float k = damage * (float)j; _k.invoke(entityLiving, damage); diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java index 0caed97f0..b6022111c 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java @@ -27,7 +27,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffectType; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; public class Fire extends MiniPlugin { diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/AsyncLoginThread.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/AsyncLoginThread.java deleted file mode 100644 index a24ab54d9..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/AsyncLoginThread.java +++ /dev/null @@ -1,80 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import net.minecraft.server.v1_6_R3.PendingConnection; - -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.util.Waitable; -import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -import org.bukkit.event.player.PlayerPreLoginEvent; - -@SuppressWarnings("deprecation") -public class AsyncLoginThread extends Thread -{ - final PendingConnection pendingConnection; - - // CraftBukkit start - CraftServer server; - - AsyncLoginThread(PendingConnection pendingconnection, CraftServer server) - { - this.server = server; - // CraftBukkit end - this.pendingConnection = pendingconnection; - } - - public void run() - { - try - { - // CraftBukkit start - if (this.pendingConnection.getSocket() == null) { - return; - } - - AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress()); - this.server.getPluginManager().callEvent(asyncEvent); - - if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) - { - final PlayerPreLoginEvent event = new PlayerPreLoginEvent(PendingConnection.d(this.pendingConnection), this.pendingConnection.getSocket().getInetAddress()); - if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) - { - event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); - } - Waitable waitable = new Waitable() - { - @Override - protected PlayerPreLoginEvent.Result evaluate() - { - AsyncLoginThread.this.server.getPluginManager().callEvent(event); - return event.getResult(); - }}; - - PendingConnection.b(this.pendingConnection).processQueue.add(waitable); - if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) - { - this.pendingConnection.disconnect(event.getKickMessage()); - return; - } - } - else - { - if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) - { - this.pendingConnection.disconnect(asyncEvent.getKickMessage()); - return; - } - } - // CraftBukkit end - - PendingConnection.a(this.pendingConnection, true); - // CraftBukkit start - } - catch (Exception exception) - { - this.pendingConnection.disconnect("Failed to verify username!"); - server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + PendingConnection.d(this.pendingConnection), exception); - // CraftBukkit end - } - } -} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityCreature.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityCreature.java deleted file mode 100644 index 38358d4c8..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityCreature.java +++ /dev/null @@ -1,315 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import java.util.Random; -import java.util.UUID; -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.TrigMath; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.event.entity.EntityTargetEvent; -import org.bukkit.event.entity.EntityTargetEvent.TargetReason; -import org.bukkit.event.entity.EntityUnleashEvent; -import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; -import org.bukkit.plugin.PluginManager; - -public abstract class EntityCreature extends EntityInsentient -{ - public static final UUID h = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); - public static final AttributeModifier i = new AttributeModifier(h, "Fleeing speed bonus", 2.0D, 2).a(false); - public PathEntity pathEntity; - public Entity target; - protected boolean bn; - protected int bo; - private ChunkCoordinates bq = new ChunkCoordinates(0, 0, 0); - private float br = -1.0F; - private PathfinderGoal bs = new PathfinderGoalMoveTowardsRestriction(this, 1.0D); - private boolean bt; - - public EntityCreature(World world) - { - super(world); - } - - protected boolean bJ() { - return false; - } - - protected void bl() { - this.world.methodProfiler.a("ai"); - if ((this.bo > 0) && (--this.bo == 0)) { - AttributeInstance attributeinstance = getAttributeInstance(GenericAttributes.d); - - attributeinstance.b(i); - } - - this.bn = bJ(); - float f11 = 16.0F; - - if (this.target == null) - { - Entity target = findTarget(); - if (target != null) { - EntityTargetEvent event = new EntityTargetEvent(getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - if (event.getTarget() == null) - this.target = null; - else { - this.target = ((CraftEntity)event.getTarget()).getHandle(); - } - } - - } - - if (this.target != null) - this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true); - } - else if (this.target.isAlive()) { - float f1 = this.target.d(this); - - if (o(this.target)) - a(this.target, f1); - } - else - { - EntityTargetEvent event = new EntityTargetEvent(getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - if (event.getTarget() == null) - this.target = null; - else { - this.target = ((CraftEntity)event.getTarget()).getHandle(); - } - } - - } - - this.world.methodProfiler.b(); - if ((!this.bn) && (this.target != null) && ((this.pathEntity == null) || (this.random.nextInt(20) == 0))) - this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true); - else if ((!this.bn) && (((this.pathEntity == null) && (this.random.nextInt(180) == 0)) || (((this.random.nextInt(120) == 0) || (this.bo > 0)) && (this.aV < 100)))) { - bK(); - } - - int i = MathHelper.floor(this.boundingBox.b + 0.5D); - boolean flag = H(); - boolean flag1 = J(); - - this.pitch = 0.0F; - if ((this.pathEntity != null) && (this.random.nextInt(100) != 0)) { - this.world.methodProfiler.a("followpath"); - Vec3D vec3d = this.pathEntity.a(this); - double d0 = this.width * 2.0F; - - while ((vec3d != null) && (vec3d.d(this.locX, vec3d.d, this.locZ) < d0 * d0)) { - this.pathEntity.a(); - if (this.pathEntity.b()) { - vec3d = null; - this.pathEntity = null; - } else { - vec3d = this.pathEntity.a(this); - } - } - - this.bd = false; - if (vec3d != null) { - double d1 = vec3d.c - this.locX; - double d2 = vec3d.e - this.locZ; - double d3 = vec3d.d - i; - - float f2 = (float)(TrigMath.atan2(d2, d1) * 180.0D / 3.141592741012573D) - 90.0F; - float f3 = MathHelper.g(f2 - this.yaw); - - this.bf = ((float)getAttributeInstance(GenericAttributes.d).getValue()); - if (f3 > 30.0F) { - f3 = 30.0F; - } - - if (f3 < -30.0F) { - f3 = -30.0F; - } - - this.yaw += f3; - if ((this.bn) && (this.target != null)) { - double d4 = this.target.locX - this.locX; - double d5 = this.target.locZ - this.locZ; - float f4 = this.yaw; - - this.yaw = ((float)(Math.atan2(d5, d4) * 180.0D / 3.141592741012573D) - 90.0F); - f3 = (f4 - this.yaw + 90.0F) * 3.141593F / 180.0F; - this.be = (-MathHelper.sin(f3) * this.bf * 1.0F); - this.bf = (MathHelper.cos(f3) * this.bf * 1.0F); - } - - if (d3 > 0.0D) { - this.bd = true; - } - } - - if (this.target != null) { - a(this.target, 30.0F, 30.0F); - } - - if ((this.positionChanged) && (!bM())) { - this.bd = true; - } - - if ((this.random.nextFloat() < 0.8F) && ((flag) || (flag1))) { - this.bd = true; - } - - this.world.methodProfiler.b(); - } else { - super.bl(); - this.pathEntity = null; - } - } - - protected void bK() { - this.world.methodProfiler.a("stroll"); - boolean flag = false; - int i = -1; - int j = -1; - int k = -1; - float f = -99999.0F; - - for (int l = 0; l < 10; l++) { - int i1 = MathHelper.floor(this.locX + this.random.nextInt(13) - 6.0D); - int j1 = MathHelper.floor(this.locY + this.random.nextInt(7) - 3.0D); - int k1 = MathHelper.floor(this.locZ + this.random.nextInt(13) - 6.0D); - float f1 = a(i1, j1, k1); - - if (f1 > f) { - f = f1; - i = i1; - j = j1; - k = k1; - flag = true; - } - } - - if (flag) { - this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true); - } - - this.world.methodProfiler.b(); - } - protected void a(Entity entity, float f) { - } - - public float a(int i, int j, int k) { - return 0.0F; - } - - protected Entity findTarget() { - return null; - } - - public boolean canSpawn() { - int i = MathHelper.floor(this.locX); - int j = MathHelper.floor(this.boundingBox.b); - int k = MathHelper.floor(this.locZ); - - return (super.canSpawn()) && (a(i, j, k) >= 0.0F); - } - - public boolean bM() { - return this.pathEntity != null; - } - - public void setPathEntity(PathEntity pathentity) { - this.pathEntity = pathentity; - } - - public Entity bN() { - return this.target; - } - - public void setTarget(Entity entity) { - this.target = entity; - } - - public boolean bO() { - return b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); - } - - public boolean b(int i, int j, int k) { - return this.br == -1.0F; - } - - public void b(int i, int j, int k, int l) { - this.bq.b(i, j, k); - this.br = l; - } - - public ChunkCoordinates bP() { - return this.bq; - } - - public float bQ() { - return this.br; - } - - public void bR() { - this.br = -1.0F; - } - - public boolean bS() { - return this.br != -1.0F; - } - - protected void bF() { - super.bF(); - if ((bH()) && (getLeashHolder() != null) && (getLeashHolder().world == this.world) && this.PullWhileLeashed) { - Entity entity = getLeashHolder(); - - b((int)entity.locX, (int)entity.locY, (int)entity.locZ, 5); - float f = d(entity); - - if (((this instanceof EntityTameableAnimal)) && (((EntityTameableAnimal)this).isSitting())) { - if (f > 10.0F) { - this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); - unleash(true, true); - } - - return; - } - - if (!this.bt) { - this.goalSelector.a(2, this.bs); - getNavigation().a(false); - this.bt = true; - } - - o(f); - if (f > 4.0F) { - getNavigation().a(entity, 1.0D); - } - - if (f > 6.0F) { - double d0 = (entity.locX - this.locX) / f; - double d1 = (entity.locY - this.locY) / f; - double d2 = (entity.locZ - this.locZ) / f; - - this.motX += d0 * Math.abs(d0) * 0.4D; - this.motY += d1 * Math.abs(d1) * 0.4D; - this.motZ += d2 * Math.abs(d2) * 0.4D; - } - - if (f > 10.0F) { - this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); - unleash(true, true); - } - } else if ((!bH()) && (this.bt)) { - this.bt = false; - this.goalSelector.a(this.bs); - getNavigation().a(true); - bR(); - } - } - - protected void o(float f) - { - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityFallingBlock.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityFallingBlock.java deleted file mode 100644 index e6a6bf1e0..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityFallingBlock.java +++ /dev/null @@ -1,246 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.Random; -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; -import org.bukkit.event.entity.EntityChangeBlockEvent; -import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; - -public class EntityFallingBlock extends Entity -{ - public int id; - public int data; - public int c; - public boolean dropItem; - private boolean f; - private boolean hurtEntities; - private int fallHurtMax; - private float fallHurtAmount; - public NBTTagCompound tileEntityData; - - public boolean spectating; - - public EntityFallingBlock(World world) - { - super(world); - this.dropItem = true; - this.fallHurtMax = 40; - this.fallHurtAmount = 2.0F; - } - - public EntityFallingBlock(World world, double d0, double d1, double d2, int i) { - this(world, d0, d1, d2, i, 0); - } - - public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int j) { - super(world); - this.dropItem = true; - this.fallHurtMax = 40; - this.fallHurtAmount = 2.0F; - this.id = i; - this.data = j; - this.m = true; - a(0.98F, 0.98F); - this.height = (this.length / 2.0F); - setPosition(d0, d1, d2); - this.motX = 0.0D; - this.motY = 0.0D; - this.motZ = 0.0D; - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; - } - - protected boolean e_() { - return false; - } - protected void a() { - } - - public boolean L() { - return !this.dead && !spectating; - } - - public void l_() { - if (this.id == 0) { - die(); - } else { - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; - this.c += 1; - this.motY -= 0.03999999910593033D; - move(this.motX, this.motY, this.motZ); - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; - if (!this.world.isStatic) { - int i = MathHelper.floor(this.locX); - int j = MathHelper.floor(this.locY); - int k = MathHelper.floor(this.locZ); - - if (this.c == 1) - { - if ((this.c != 1) || (this.world.getTypeId(i, j, k) != this.id) || (this.world.getData(i, j, k) != this.data) || (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, 0, 0).isCancelled())) { - die(); - return; - } - - this.world.setAir(i, j, k); - } - - if (this.onGround) { - this.motX *= 0.699999988079071D; - this.motZ *= 0.699999988079071D; - this.motY *= -0.5D; - if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) { - die(); - - if ((!this.f) && (this.world.mayPlace(this.id, i, j, k, true, 1, (Entity)null, (ItemStack)null)) && (!BlockSand.canFall(this.world, i, j - 1, k)) && (i >= -30000000) && (k >= -30000000) && (i < 30000000) && (k < 30000000) && (j > 0) && (j < 256) && ((this.world.getTypeId(i, j, k) != this.id) || (this.world.getData(i, j, k) != this.data))) { - if (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.id, this.data).isCancelled()) { - return; - } - this.world.setTypeIdAndData(i, j, k, this.id, this.data, 3); - - if ((Block.byId[this.id] instanceof BlockSand)) { - ((BlockSand)Block.byId[this.id]).a_(this.world, i, j, k, this.data); - } - - if ((this.tileEntityData != null) && ((Block.byId[this.id] instanceof IContainer))) { - TileEntity tileentity = this.world.getTileEntity(i, j, k); - - if (tileentity != null) { - NBTTagCompound nbttagcompound = new NBTTagCompound(); - - tileentity.b(nbttagcompound); - Iterator iterator = this.tileEntityData.c().iterator(); - - while (iterator.hasNext()) { - NBTBase nbtbase = (NBTBase)iterator.next(); - - if ((!nbtbase.getName().equals("x")) && (!nbtbase.getName().equals("y")) && (!nbtbase.getName().equals("z"))) { - nbttagcompound.set(nbtbase.getName(), nbtbase.clone()); - } - } - - tileentity.a(nbttagcompound); - tileentity.update(); - } - } - } else if ((this.dropItem) && (!this.f)) { - a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F); - } - } - } else if (((this.c > 100) && (!this.world.isStatic) && ((j < 1) || (j > 256))) || (this.c > 600)) { - if (this.dropItem) { - a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F); - } - - die(); - } - } - } - } - - protected void b(float f) { - if (this.hurtEntities) { - int i = MathHelper.f(f - 1.0F); - - if (i > 0) { - ArrayList arraylist = new ArrayList(this.world.getEntities(this, this.boundingBox)); - DamageSource damagesource = this.id == Block.ANVIL.id ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK; - Iterator iterator = arraylist.iterator(); - - while (iterator.hasNext()) { - Entity entity = (Entity)iterator.next(); - - float damage = Math.min(MathHelper.d(i * this.fallHurtAmount), this.fallHurtMax); - - EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(this, entity, EntityDamageEvent.DamageCause.FALLING_BLOCK, damage); - if (!event.isCancelled()) - { - entity.damageEntity(damagesource, (float)event.getDamage()); - } - } - - if ((this.id == Block.ANVIL.id) && (this.random.nextFloat() < 0.0500000007450581D + i * 0.05D)) { - int j = this.data >> 2; - int k = this.data & 0x3; - - j++; - if (j > 2) - this.f = true; - else - this.data = (k | j << 2); - } - } - } - } - - protected void b(NBTTagCompound nbttagcompound) - { - nbttagcompound.setByte("Tile", (byte)this.id); - nbttagcompound.setInt("TileID", this.id); - nbttagcompound.setByte("Data", (byte)this.data); - nbttagcompound.setByte("Time", (byte)this.c); - nbttagcompound.setBoolean("DropItem", this.dropItem); - nbttagcompound.setBoolean("HurtEntities", this.hurtEntities); - nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount); - nbttagcompound.setInt("FallHurtMax", this.fallHurtMax); - if (this.tileEntityData != null) - nbttagcompound.setCompound("TileEntityData", this.tileEntityData); - } - - protected void a(NBTTagCompound nbttagcompound) - { - if (nbttagcompound.hasKey("TileID")) - this.id = nbttagcompound.getInt("TileID"); - else { - this.id = (nbttagcompound.getByte("Tile") & 0xFF); - } - - this.data = (nbttagcompound.getByte("Data") & 0xFF); - this.c = (nbttagcompound.getByte("Time") & 0xFF); - if (nbttagcompound.hasKey("HurtEntities")) { - this.hurtEntities = nbttagcompound.getBoolean("HurtEntities"); - this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount"); - this.fallHurtMax = nbttagcompound.getInt("FallHurtMax"); - } else if (this.id == Block.ANVIL.id) { - this.hurtEntities = true; - } - - if (nbttagcompound.hasKey("DropItem")) { - this.dropItem = nbttagcompound.getBoolean("DropItem"); - } - - if (nbttagcompound.hasKey("TileEntityData")) { - this.tileEntityData = nbttagcompound.getCompound("TileEntityData"); - } - - if (nbttagcompound.hasKey("Bukkit.tileData")) { - this.tileEntityData = ((NBTTagCompound)nbttagcompound.getCompound("Bukkit.tileData").clone()); - } - - if (this.id == 0) - this.id = Block.SAND.id; - } - - public void a(boolean flag) - { - this.hurtEntities = flag; - } - - public void a(CrashReportSystemDetails crashreportsystemdetails) { - super.a(crashreportsystemdetails); - crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(this.id)); - crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data)); - } - - public boolean damageEntity(DamageSource damagesource, float f) { - CraftEventFactory.handleEntityDamageEvent(this, damagesource, f); - return false; - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityGhast.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityGhast.java deleted file mode 100644 index 34340bc9a..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityGhast.java +++ /dev/null @@ -1,263 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -//CraftBukkit start -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; -import org.bukkit.event.entity.EntityTargetEvent; -//CraftBukkit end - -public class EntityGhast extends EntityFlying implements IMonster { - - public int h; - public double i; - public double j; - public double bn; - private Entity target; - private int br; - public int bo; - public int bp; - private int explosionPower = 1; - - public EntityGhast(World world) { - super(world); - this.a(4.0F, 4.0F); - this.fireProof = true; - this.b = 5; - } - - public boolean damageEntity(DamageSource damagesource, float f) { - if (this.isInvulnerable()) { - return false; - } else if ("fireball".equals(damagesource.n()) && damagesource.getEntity() instanceof EntityHuman) { - super.damageEntity(damagesource, 1000.0F); - ((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y); - return true; - } else { - return super.damageEntity(damagesource, f); - } - } - - protected void a() { - super.a(); - this.datawatcher.a(16, Byte.valueOf((byte) 0)); - } - - protected void az() { - super.az(); - this.getAttributeInstance(GenericAttributes.a).setValue(10.0D); - } - - protected void bl() { - if (!this.world.isStatic && this.world.difficulty == 0) { - this.die(); - } - - if (Vegetated) - { - double d0 = this.i - this.locX; - double d1 = this.j - this.locY; - double d2 = this.bn - this.locZ; - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - - this.motX += d0 / d3 * 0.1D; - this.motY += d1 / d3 * 0.1D; - this.motZ += d2 / d3 * 0.1D; - - double d5 = this.i - this.locX; - double d6 = this.bn - this.locZ; - - this.aN = this.yaw = -((float) Math.atan2(d5, d6)) * 180.0F / 3.1415927F; - - return; - } - - this.u(); - this.bo = this.bp; - double d0 = this.i - this.locX; - double d1 = this.j - this.locY; - double d2 = this.bn - this.locZ; - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - - if (d3 < 1.0D || d3 > 3600.0D) { - this.i = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.j = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); - this.bn = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); - } - - if (this.h-- <= 0) { - this.h += this.random.nextInt(5) + 2; - d3 = (double) MathHelper.sqrt(d3); - if (this.a(this.i, this.j, this.bn, d3)) { - this.motX += d0 / d3 * 0.1D; - this.motY += d1 / d3 * 0.1D; - this.motZ += d2 / d3 * 0.1D; - } else { - this.i = this.locX; - this.j = this.locY; - this.bn = this.locZ; - } - } - - if (this.target != null && this.target.dead) { - // CraftBukkit start - EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - if (event.getTarget() == null) { - this.target = null; - } else { - this.target = ((CraftEntity) event.getTarget()).getHandle(); - } - } - // CraftBukkit end - } - - if (this.target == null || this.br-- <= 0) { - // CraftBukkit start - Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D); - if (target != null) { - EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); - this.world.getServer().getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - if (event.getTarget() == null) { - this.target = null; - } else { - this.target = ((CraftEntity) event.getTarget()).getHandle(); - } - } - } - // CraftBukkit end - - if (this.target != null) { - this.br = 20; - } - } - - double d4 = 64.0D; - - if (this.target != null && this.target.e((Entity) this) < d4 * d4) { - double d5 = this.target.locX - this.locX; - double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F)); - double d7 = this.target.locZ - this.locZ; - - this.aN = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; - if (this.o(this.target)) { - if (this.bp == 10) { - this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0); - } - - ++this.bp; - if (this.bp == 20) { - this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0); - EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7); - - // CraftBukkit - set bukkitYield when setting explosionpower - entitylargefireball.bukkitYield = entitylargefireball.yield = this.explosionPower; - double d8 = 4.0D; - Vec3D vec3d = this.j(1.0F); - - entitylargefireball.locX = this.locX + vec3d.c * d8; - entitylargefireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D; - entitylargefireball.locZ = this.locZ + vec3d.e * d8; - this.world.addEntity(entitylargefireball); - this.bp = -40; - } - } else if (this.bp > 0) { - --this.bp; - } - } else { - this.aN = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F; - if (this.bp > 0) { - --this.bp; - } - } - - if (!this.world.isStatic) { - byte b0 = this.datawatcher.getByte(16); - byte b1 = (byte) (this.bp > 10 ? 1 : 0); - - if (b0 != b1) { - this.datawatcher.watch(16, Byte.valueOf(b1)); - } - } - } - - private boolean a(double d0, double d1, double d2, double d3) { - double d4 = (this.i - this.locX) / d3; - double d5 = (this.j - this.locY) / d3; - double d6 = (this.bn - this.locZ) / d3; - AxisAlignedBB axisalignedbb = this.boundingBox.clone(); - - for (int i = 1; (double) i < d3; ++i) { - axisalignedbb.d(d4, d5, d6); - if (!this.world.getCubes(this, axisalignedbb).isEmpty()) { - return false; - } - } - - return true; - } - - protected String r() { - return "mob.ghast.moan"; - } - - protected String aO() { - return "mob.ghast.scream"; - } - - protected String aP() { - return "mob.ghast.death"; - } - - protected int getLootId() { - return Item.SULPHUR.id; - } - - protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - java.util.List loot = new java.util.ArrayList(); - int j = this.random.nextInt(2) + this.random.nextInt(1 + i); - - int k; - - if (j > 0) { - loot.add(CraftItemStack.asNewCraftStack(Item.GHAST_TEAR, j)); - } - - j = this.random.nextInt(3) + this.random.nextInt(1 + i); - - if (j > 0) { - loot.add(CraftItemStack.asNewCraftStack(Item.SULPHUR, j)); - } - - org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callEntityDeathEvent(this, loot); - // CraftBukkit end - } - - protected float ba() { - return 10.0F; - } - - public boolean canSpawn() { - return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0; - } - - public int bv() { - return 1; - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - nbttagcompound.setInt("ExplosionPower", this.explosionPower); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - if (nbttagcompound.hasKey("ExplosionPower")) { - this.explosionPower = nbttagcompound.getInt("ExplosionPower"); - } - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityTNTPrimed.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityTNTPrimed.java deleted file mode 100644 index ab8b6fedf..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityTNTPrimed.java +++ /dev/null @@ -1,102 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.entity.Explosive; -import org.bukkit.event.entity.ExplosionPrimeEvent; -import org.bukkit.plugin.PluginManager; - -public class EntityTNTPrimed extends Entity -{ - public int fuseTicks; - private EntityLiving source; - public float yield = 4.0F; - public boolean isIncendiary = false; - - public boolean spectating = false; - - public EntityTNTPrimed(World world) { - super(world); - this.m = true; - a(0.98F, 0.98F); - this.height = (this.length / 2.0F); - } - - public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { - this(world); - setPosition(d0, d1, d2); - float f = (float)(Math.random() * 3.141592741012573D * 2.0D); - - this.motX = (-(float)Math.sin(f) * 0.02F); - this.motY = 0.2000000029802322D; - this.motZ = (-(float)Math.cos(f) * 0.02F); - this.fuseTicks = 80; - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; - this.source = entityliving; - } - protected void a() { - } - - protected boolean e_() { - return false; - } - - public boolean L() { - return !this.dead && !spectating; - } - - public void l_() { - this.lastX = this.locX; - this.lastY = this.locY; - this.lastZ = this.locZ; - this.motY -= 0.03999999910593033D; - move(this.motX, this.motY, this.motZ); - this.motX *= 0.9800000190734863D; - this.motY *= 0.9800000190734863D; - this.motZ *= 0.9800000190734863D; - if (this.onGround) { - this.motX *= 0.699999988079071D; - this.motZ *= 0.699999988079071D; - this.motY *= -0.5D; - } - - if (this.fuseTicks-- <= 0) - { - if (!this.world.isStatic) { - explode(); - } - die(); - } - else { - this.world.addParticle("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); - } - } - - private void explode() - { - CraftServer server = this.world.getServer(); - - ExplosionPrimeEvent event = new ExplosionPrimeEvent((Explosive)CraftEntity.getEntity(server, this)); - server.getPluginManager().callEvent(event); - - if (!event.isCancelled()) - { - this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true); - } - } - - protected void b(NBTTagCompound nbttagcompound) - { - nbttagcompound.setByte("Fuse", (byte)this.fuseTicks); - } - - protected void a(NBTTagCompound nbttagcompound) { - this.fuseTicks = nbttagcompound.getByte("Fuse"); - } - - public EntityLiving getSource() { - return this.source; - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Packet.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Packet.java deleted file mode 100644 index 48e1fd5ed..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Packet.java +++ /dev/null @@ -1,435 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import java.io.DataInput; -import java.io.DataOutput; -import java.io.EOFException; -import java.io.IOException; -import java.net.Socket; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import net.minecraft.server.v1_6_R3.Connection; -import net.minecraft.server.v1_6_R3.IConsoleLogManager; -import net.minecraft.server.v1_6_R3.IntHashMap; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.NBTCompressedStreamTools; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet0KeepAlive; -import net.minecraft.server.v1_6_R3.Packet100OpenWindow; -import net.minecraft.server.v1_6_R3.Packet101CloseWindow; -import net.minecraft.server.v1_6_R3.Packet102WindowClick; -import net.minecraft.server.v1_6_R3.Packet103SetSlot; -import net.minecraft.server.v1_6_R3.Packet104WindowItems; -import net.minecraft.server.v1_6_R3.Packet105CraftProgressBar; -import net.minecraft.server.v1_6_R3.Packet106Transaction; -import net.minecraft.server.v1_6_R3.Packet107SetCreativeSlot; -import net.minecraft.server.v1_6_R3.Packet108ButtonClick; -import net.minecraft.server.v1_6_R3.Packet10Flying; -import net.minecraft.server.v1_6_R3.Packet11PlayerPosition; -import net.minecraft.server.v1_6_R3.Packet12PlayerLook; -import net.minecraft.server.v1_6_R3.Packet130UpdateSign; -import net.minecraft.server.v1_6_R3.Packet131ItemData; -import net.minecraft.server.v1_6_R3.Packet132TileEntityData; -import net.minecraft.server.v1_6_R3.Packet133OpenTileEntity; -import net.minecraft.server.v1_6_R3.Packet13PlayerLookMove; -import net.minecraft.server.v1_6_R3.Packet14BlockDig; -import net.minecraft.server.v1_6_R3.Packet15Place; -import net.minecraft.server.v1_6_R3.Packet16BlockItemSwitch; -import net.minecraft.server.v1_6_R3.Packet17EntityLocationAction; -import net.minecraft.server.v1_6_R3.Packet18ArmAnimation; -import net.minecraft.server.v1_6_R3.Packet19EntityAction; -import net.minecraft.server.v1_6_R3.Packet1Login; -import net.minecraft.server.v1_6_R3.Packet200Statistic; -import net.minecraft.server.v1_6_R3.Packet201PlayerInfo; -import net.minecraft.server.v1_6_R3.Packet202Abilities; -import net.minecraft.server.v1_6_R3.Packet203TabComplete; -import net.minecraft.server.v1_6_R3.Packet204LocaleAndViewDistance; -import net.minecraft.server.v1_6_R3.Packet205ClientCommand; -import net.minecraft.server.v1_6_R3.Packet206SetScoreboardObjective; -import net.minecraft.server.v1_6_R3.Packet207SetScoreboardScore; -import net.minecraft.server.v1_6_R3.Packet208SetScoreboardDisplayObjective; -import net.minecraft.server.v1_6_R3.Packet209SetScoreboardTeam; -import net.minecraft.server.v1_6_R3.Packet20NamedEntitySpawn; -import net.minecraft.server.v1_6_R3.Packet22Collect; -import net.minecraft.server.v1_6_R3.Packet23VehicleSpawn; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; -import net.minecraft.server.v1_6_R3.Packet250CustomPayload; -import net.minecraft.server.v1_6_R3.Packet252KeyResponse; -import net.minecraft.server.v1_6_R3.Packet253KeyRequest; -import net.minecraft.server.v1_6_R3.Packet254GetInfo; -import net.minecraft.server.v1_6_R3.Packet255KickDisconnect; -import net.minecraft.server.v1_6_R3.Packet25EntityPainting; -import net.minecraft.server.v1_6_R3.Packet26AddExpOrb; -import net.minecraft.server.v1_6_R3.Packet27PlayerInput; -import net.minecraft.server.v1_6_R3.Packet28EntityVelocity; -import net.minecraft.server.v1_6_R3.Packet29DestroyEntity; -import net.minecraft.server.v1_6_R3.Packet2Handshake; -import net.minecraft.server.v1_6_R3.Packet30Entity; -import net.minecraft.server.v1_6_R3.Packet31RelEntityMove; -import net.minecraft.server.v1_6_R3.Packet32EntityLook; -import net.minecraft.server.v1_6_R3.Packet33RelEntityMoveLook; -import net.minecraft.server.v1_6_R3.Packet34EntityTeleport; -import net.minecraft.server.v1_6_R3.Packet35EntityHeadRotation; -import net.minecraft.server.v1_6_R3.Packet38EntityStatus; -import net.minecraft.server.v1_6_R3.Packet39AttachEntity; -import net.minecraft.server.v1_6_R3.Packet3Chat; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; -import net.minecraft.server.v1_6_R3.Packet41MobEffect; -import net.minecraft.server.v1_6_R3.Packet42RemoveMobEffect; -import net.minecraft.server.v1_6_R3.Packet43SetExperience; -import net.minecraft.server.v1_6_R3.Packet44UpdateAttributes; -import net.minecraft.server.v1_6_R3.Packet4UpdateTime; -import net.minecraft.server.v1_6_R3.Packet51MapChunk; -import net.minecraft.server.v1_6_R3.Packet52MultiBlockChange; -import net.minecraft.server.v1_6_R3.Packet53BlockChange; -import net.minecraft.server.v1_6_R3.Packet54PlayNoteBlock; -import net.minecraft.server.v1_6_R3.Packet55BlockBreakAnimation; -import net.minecraft.server.v1_6_R3.Packet56MapChunkBulk; -import net.minecraft.server.v1_6_R3.Packet5EntityEquipment; -import net.minecraft.server.v1_6_R3.Packet60Explosion; -import net.minecraft.server.v1_6_R3.Packet61WorldEvent; -import net.minecraft.server.v1_6_R3.Packet62NamedSoundEffect; -import net.minecraft.server.v1_6_R3.Packet63WorldParticles; -import net.minecraft.server.v1_6_R3.Packet6SpawnPosition; -import net.minecraft.server.v1_6_R3.Packet70Bed; -import net.minecraft.server.v1_6_R3.Packet71Weather; -import net.minecraft.server.v1_6_R3.Packet7UseEntity; -import net.minecraft.server.v1_6_R3.Packet8UpdateHealth; -import net.minecraft.server.v1_6_R3.Packet9Respawn; -import net.minecraft.server.v1_6_R3.PacketCounter; - -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; // CraftBukkit - -public abstract class Packet { - - public static IntHashMap l = new IntHashMap(); - private static Map a = new HashMap(); - private static Set b = new HashSet(); - private static Set c = new HashSet(); - protected IConsoleLogManager m; - public final long timestamp = MinecraftServer.aq(); - public static long o; - public static long p; - public static long q; - public static long r; - public boolean lowPriority; - // CraftBukkit start - Calculate packet ID once - used a bunch of times - private int packetID; - - public Packet() { - packetID = ((Integer) a.get(this.getClass())).intValue(); - } - // CraftBukkit end - - static void a(int i, boolean flag, boolean flag1, Class oclass) { - if (l.b(i)) { - throw new IllegalArgumentException("Duplicate packet id:" + i); - } else if (a.containsKey(oclass)) { - throw new IllegalArgumentException("Duplicate packet class:" + oclass); - } else { - l.a(i, oclass); - a.put(oclass, Integer.valueOf(i)); - if (flag) { - b.add(Integer.valueOf(i)); - } - - if (flag1) { - c.add(Integer.valueOf(i)); - } - } - } - - public static Packet a(IConsoleLogManager iconsolelogmanager, int i) { - try { - Class oclass = (Class) l.get(i); - - return oclass == null ? null : (Packet) oclass.newInstance(); - } catch (Exception exception) { - exception.printStackTrace(); - iconsolelogmanager.severe("Skipping packet with id " + i); - return null; - } - } - - public static void a(DataOutput dataoutput, byte[] abyte) throws IOException { // CraftBukkit - throws IOException - dataoutput.writeShort(abyte.length); - dataoutput.write(abyte); - } - - public static byte[] b(DataInput datainput) throws IOException { // CraftBukkit - throws IOException - short short1 = datainput.readShort(); - - if (short1 < 0) { - throw new IOException("Key was smaller than nothing! Weird key!"); - } else { - byte[] abyte = new byte[short1]; - - datainput.readFully(abyte); - return abyte; - } - } - - public final int n() { - return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit - } - - public static Packet a(IConsoleLogManager iconsolelogmanager, DataInput datainput, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException - boolean flag1 = false; - Packet packet = null; - int i = socket.getSoTimeout(); - - int j; - - try { - j = datainput.readUnsignedByte(); - if (flag && !c.contains(Integer.valueOf(j)) || !flag && !b.contains(Integer.valueOf(j))) { - throw new IOException("Bad packet id " + j); - } - - packet = a(iconsolelogmanager, j); - if (packet == null) { - throw new IOException("Bad packet id " + j); - } - - packet.m = iconsolelogmanager; - if (packet instanceof Packet254GetInfo) { - socket.setSoTimeout(1500); - } - - packet.a(datainput); - ++o; - p += (long) packet.a(); - } catch (EOFException eofexception) { - if (eofexception.getMessage() != null) - iconsolelogmanager.severe("Reached end of stream for " + socket.getInetAddress()); - - return null; - } - - // CraftBukkit start - catch (java.net.SocketTimeoutException exception) { - iconsolelogmanager.info("Read timed out"); - return null; - } catch (java.net.SocketException exception) { - iconsolelogmanager.info("Connection reset"); - return null; - } - // CraftBukkit end - - PacketCounter.a(j, (long) packet.a()); - ++o; - p += (long) packet.a(); - socket.setSoTimeout(i); - return packet; - } - - public static void a(Packet packet, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException - dataoutput.write(packet.n()); - packet.a(dataoutput); - ++q; - r += (long) packet.a(); - } - - public static void a(String s, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException - if (s.length() > 32767) { - throw new IOException("String too big"); - } else { - dataoutput.writeShort(s.length()); - dataoutput.writeChars(s); - } - } - - public static String a(DataInput datainput, int i) throws IOException { // CraftBukkit - throws IOException - short short1 = datainput.readShort(); - - if (short1 > i) { - throw new IOException("Received string length longer than maximum allowed (" + short1 + " > " + i + ")"); - } else if (short1 < 0) { - throw new IOException("Received string length is less than zero! Weird string!"); - } else { - StringBuilder stringbuilder = new StringBuilder(); - - for (int j = 0; j < short1; ++j) { - stringbuilder.append(datainput.readChar()); - } - - return stringbuilder.toString(); - } - } - - public abstract void a(DataInput datainput) throws IOException; // CraftBukkit - throws IOException - - public abstract void a(DataOutput dataoutput) throws IOException; // CraftBukkit - throws IOException - - public abstract void handle(Connection connection); - - public abstract int a(); - - public boolean e() { - return false; - } - - public boolean a(Packet packet) { - return false; - } - - public boolean a_() { - return this instanceof Packet3Chat && !((Packet3Chat) this).message.startsWith("/"); // CraftBukkit - async chat - } - - public String toString() { - String s = this.getClass().getSimpleName(); - - return s; - } - - public static ItemStack c(DataInput datainput) throws IOException { // CraftBukkit - throws IOException - ItemStack itemstack = null; - short short1 = datainput.readShort(); - - if (short1 >= 0) { - byte b0 = datainput.readByte(); - short short2 = datainput.readShort(); - - itemstack = new ItemStack(short1, b0, short2); - itemstack.tag = d(datainput); - // CraftBukkit start - if (itemstack.tag != null) { - CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack)); - } - // CraftBukkit end - } - - return itemstack; - } - - public static void a(ItemStack itemstack, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException - if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem() - dataoutput.writeShort(-1); - } else { - dataoutput.writeShort(itemstack.id); - dataoutput.writeByte(itemstack.count); - dataoutput.writeShort(itemstack.getData()); - NBTTagCompound nbttagcompound = null; - - if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) { - nbttagcompound = itemstack.tag; - } - - a(nbttagcompound, dataoutput); - } - } - - public static NBTTagCompound d(DataInput datainput) throws IOException { // CraftBukkit - throws IOException - short short1 = datainput.readShort(); - - if (short1 < 0) { - return null; - } else { - byte[] abyte = new byte[short1]; - - datainput.readFully(abyte); - return NBTCompressedStreamTools.a(abyte); - } - } - - protected static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException - if (nbttagcompound == null) { - dataoutput.writeShort(-1); - } else { - byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound); - - dataoutput.writeShort((short) abyte.length); - dataoutput.write(abyte); - } - } - - static { - a(0, true, true, Packet0KeepAlive.class); - a(1, true, true, Packet1Login.class); - a(2, false, true, Packet2Handshake.class); - a(3, true, true, Packet3Chat.class); - a(4, true, false, Packet4UpdateTime.class); - a(5, true, false, Packet5EntityEquipment.class); - a(6, true, false, Packet6SpawnPosition.class); - a(7, false, true, Packet7UseEntity.class); - a(8, true, false, Packet8UpdateHealth.class); - a(9, true, true, Packet9Respawn.class); - a(10, true, true, Packet10Flying.class); - a(11, true, true, Packet11PlayerPosition.class); - a(12, true, true, Packet12PlayerLook.class); - a(13, true, true, Packet13PlayerLookMove.class); - a(14, false, true, Packet14BlockDig.class); - a(15, false, true, Packet15Place.class); - a(16, true, true, Packet16BlockItemSwitch.class); - a(17, true, false, Packet17EntityLocationAction.class); - a(18, true, true, Packet18ArmAnimation.class); - a(19, false, true, Packet19EntityAction.class); - a(20, true, false, Packet20NamedEntitySpawn.class); - a(22, true, false, Packet22Collect.class); - a(23, true, false, Packet23VehicleSpawn.class); - a(24, true, false, Packet24MobSpawn.class); - a(25, true, false, Packet25EntityPainting.class); - a(26, true, false, Packet26AddExpOrb.class); - a(27, false, true, Packet27PlayerInput.class); - a(28, true, false, Packet28EntityVelocity.class); - a(29, true, false, Packet29DestroyEntity.class); - a(30, true, false, Packet30Entity.class); - a(31, true, false, Packet31RelEntityMove.class); - a(32, true, false, Packet32EntityLook.class); - a(33, true, false, Packet33RelEntityMoveLook.class); - a(34, true, false, Packet34EntityTeleport.class); - a(35, true, false, Packet35EntityHeadRotation.class); - a(38, true, false, Packet38EntityStatus.class); - a(39, true, false, Packet39AttachEntity.class); - a(40, true, false, Packet40EntityMetadata.class); - a(41, true, false, Packet41MobEffect.class); - a(42, true, false, Packet42RemoveMobEffect.class); - a(43, true, false, Packet43SetExperience.class); - a(44, true, false, Packet44UpdateAttributes.class); - a(51, true, false, Packet51MapChunk.class); - a(52, true, false, Packet52MultiBlockChange.class); - a(53, true, false, Packet53BlockChange.class); - a(54, true, false, Packet54PlayNoteBlock.class); - a(55, true, false, Packet55BlockBreakAnimation.class); - a(56, true, false, Packet56MapChunkBulk.class); - a(60, true, false, Packet60Explosion.class); - a(61, true, false, Packet61WorldEvent.class); - a(62, true, false, Packet62NamedSoundEffect.class); - a(63, true, false, Packet63WorldParticles.class); - a(70, true, false, Packet70Bed.class); - a(71, true, false, Packet71Weather.class); - a(100, true, false, Packet100OpenWindow.class); - a(101, true, true, Packet101CloseWindow.class); - a(102, false, true, Packet102WindowClick.class); - a(103, true, false, Packet103SetSlot.class); - a(104, true, false, Packet104WindowItems.class); - a(105, true, false, Packet105CraftProgressBar.class); - a(106, true, true, Packet106Transaction.class); - a(107, true, true, Packet107SetCreativeSlot.class); - a(108, false, true, Packet108ButtonClick.class); - a(130, true, true, Packet130UpdateSign.class); - a(131, true, false, Packet131ItemData.class); - a(132, true, false, Packet132TileEntityData.class); - a(133, true, false, Packet133OpenTileEntity.class); - a(200, true, false, Packet200Statistic.class); - a(201, true, false, Packet201PlayerInfo.class); - a(202, true, true, Packet202Abilities.class); - a(203, true, true, Packet203TabComplete.class); - a(204, false, true, Packet204LocaleAndViewDistance.class); - a(205, false, true, Packet205ClientCommand.class); - a(206, true, false, Packet206SetScoreboardObjective.class); - a(207, true, false, Packet207SetScoreboardScore.class); - a(208, true, false, Packet208SetScoreboardDisplayObjective.class); - a(209, true, false, Packet209SetScoreboardTeam.class); - a(250, true, true, Packet250CustomPayload.class); - a(252, true, true, Packet252KeyResponse.class); - a(253, true, false, Packet253KeyRequest.class); - a(254, false, true, Packet254GetInfo.class); - a(255, true, true, Packet255KickDisconnect.class); - } -} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PendingConnection.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PendingConnection.java deleted file mode 100644 index e219fb766..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PendingConnection.java +++ /dev/null @@ -1,234 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import java.io.Serializable; -import java.net.InetAddress; -import java.net.Socket; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.Random; -import javax.crypto.SecretKey; - -import net.minecraft.server.v1_6_R3.Connection; -import net.minecraft.server.v1_6_R3.DedicatedServerConnection; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.INetworkManager; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.NetworkManager; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet1Login; -import net.minecraft.server.v1_6_R3.Packet205ClientCommand; -import net.minecraft.server.v1_6_R3.Packet252KeyResponse; -import net.minecraft.server.v1_6_R3.Packet253KeyRequest; -import net.minecraft.server.v1_6_R3.Packet254GetInfo; -import net.minecraft.server.v1_6_R3.Packet255KickDisconnect; -import net.minecraft.server.v1_6_R3.Packet2Handshake; -import net.minecraft.server.v1_6_R3.PendingConnection; -import net.minecraft.server.v1_6_R3.PlayerList; -import net.minecraft.server.v1_6_R3.StripColor; - -public class PendingConnection extends Connection { - - private static Random random = new Random(); - private byte[] d; - private final MinecraftServer server; - public final NetworkManager networkManager; - public boolean b; - private int f; - private String g; - private volatile boolean h; - private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix - private boolean j; - private SecretKey k; - public String hostname = ""; // CraftBukkit - add field - - public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException - this.server = minecraftserver; - this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.H().getPrivate()); - this.networkManager.e = 0; - } - - // CraftBukkit start - public Socket getSocket() { - return this.networkManager.getSocket(); - } - // CraftBukkit end - - public void d() { - if (this.h) { - this.e(); - } - - if (this.f++ == 600) { - this.disconnect("Took too long to log in"); - } else { - this.networkManager.b(); - } - } - - public void disconnect(String s) { - try { - this.server.getLogger().info("Disconnecting " + this.getName() + ": " + s); - this.networkManager.queue(new Packet255KickDisconnect(s)); - this.networkManager.d(); - this.b = true; - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - public void a(Packet2Handshake packet2handshake) { - if (this.g != null) { - this.disconnect("Quit repeating yourself!"); - } else { - this.g = packet2handshake.f(); - if (!this.g.equals(StripColor.a(this.g))) { - this.disconnect("Invalid username!"); - } else { - PublicKey publickey = this.server.H().getPublic(); - if (packet2handshake.d() != 78) { - if (packet2handshake.d() > 78) { - this.disconnect("Outdated server!"); - } else { - this.disconnect("Outdated client!"); - } - } else { - this.loginKey = this.server.getOnlineMode() ? Long.toString(random.nextLong(), 16) : "-"; - this.d = new byte[4]; - random.nextBytes(this.d); - this.networkManager.queue(new Packet253KeyRequest(this.loginKey, publickey, this.d)); - } - } - } - } - - public void a(Packet252KeyResponse packet252keyresponse) { - PrivateKey privatekey = this.server.H().getPrivate(); - - this.k = packet252keyresponse.a(privatekey); - if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) { - this.disconnect("Invalid client reply"); - } - - this.networkManager.queue(new Packet252KeyResponse()); - } - - public void a(Packet205ClientCommand packet205clientcommand) { - if (packet205clientcommand.a == 0) { - if (this.j) { - this.disconnect("Duplicate login"); - return; - } - - this.j = true; - (new AsyncLoginThread(this, server.server)).start(); // CraftBukkit - add CraftServer - } - } - - public void a(Packet1Login packet1login) {} - - public void e() { - // CraftBukkit start - EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.g, this.hostname); - - if (s == null) { - // this.disconnect(s); - return; - // CraftBukkit end - } else { - EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.g -> s - - if (entityplayer != null) { - this.server.getPlayerList().a((INetworkManager) this.networkManager, entityplayer); - } - } - - this.b = true; - } - - public void a(String s, Object[] aobject) { - this.server.getLogger().info(this.getName() + " lost connection"); - this.b = true; - } - - public void a(Packet254GetInfo packet254getinfo) { - if (this.networkManager.getSocket() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it. - try { - PlayerList playerlist = this.server.getPlayerList(); - String s = null; - // CraftBukkit - org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers()); - if (packet254getinfo.d()) { - // CraftBukkit - s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers(); - } else { - List list = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(78), this.server.getVersion(), pingEvent.getMotd(), Integer.valueOf(playerlist.getPlayerCount()), pingEvent.getMaxPlayers()}); - - Object object; - - for (Iterator iterator = list.iterator(); iterator.hasNext(); s = s + object.toString().replaceAll("\0", "")) { - object = iterator.next(); - if (s == null) { - s = "\u00A7"; - } else { - s = s + '\0'; - } - } - } - - InetAddress inetaddress = null; - - if (this.networkManager.getSocket() != null) { - inetaddress = this.networkManager.getSocket().getInetAddress(); - } - - this.networkManager.queue(new Packet255KickDisconnect(s)); - this.networkManager.d(); - if (inetaddress != null && this.server.ag() instanceof DedicatedServerConnection) { - ((DedicatedServerConnection) this.server.ag()).a(inetaddress); - } - - this.b = true; - } catch (Exception exception) { - exception.printStackTrace(); - } - } - - public void onUnhandledPacket(Packet packet) { - this.disconnect("Protocol error"); - } - - public String getName() { - return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString(); - } - - public boolean a() { - return true; - } - - public boolean c() { - return this.b; - } - - static String a(PendingConnection pendingconnection) { - return pendingconnection.loginKey; - } - - static MinecraftServer b(PendingConnection pendingconnection) { - return pendingconnection.server; - } - - static SecretKey c(PendingConnection pendingconnection) { - return pendingconnection.k; - } - - static String d(PendingConnection pendingconnection) { - return pendingconnection.g; - } - - static boolean a(PendingConnection pendingconnection, boolean flag) { - return pendingconnection.h = flag; - } -} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerConnection.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerConnection.java deleted file mode 100644 index a3202306c..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerConnection.java +++ /dev/null @@ -1,1902 +0,0 @@ -package net.minecraft.server.v1_6_R3; - -import java.io.ByteArrayInputStream; -import java.io.DataInput; -import java.io.DataInputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Random; -import java.util.concurrent.Callable; - -import net.minecraft.server.v1_6_R3.AxisAlignedBB; -import net.minecraft.server.v1_6_R3.BanEntry; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.ChatMessage; -import net.minecraft.server.v1_6_R3.Connection; -import net.minecraft.server.v1_6_R3.Container; -import net.minecraft.server.v1_6_R3.ContainerAnvil; -import net.minecraft.server.v1_6_R3.ContainerBeacon; -import net.minecraft.server.v1_6_R3.ContainerMerchant; -import net.minecraft.server.v1_6_R3.CrashReport; -import net.minecraft.server.v1_6_R3.CrashReportConnectionPacketClass; -import net.minecraft.server.v1_6_R3.CrashReportConnectionPacketID; -import net.minecraft.server.v1_6_R3.CrashReportSystemDetails; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityArrow; -import net.minecraft.server.v1_6_R3.EntityExperienceOrb; -import net.minecraft.server.v1_6_R3.EntityHorse; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.EntityItem; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EnumChatFormat; -import net.minecraft.server.v1_6_R3.EnumMovingObjectType; -import net.minecraft.server.v1_6_R3.IInventory; -import net.minecraft.server.v1_6_R3.INetworkManager; -import net.minecraft.server.v1_6_R3.IntHashMap; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.ItemBookAndQuill; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.ItemWrittenBook; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.MovingObjectPosition; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet0KeepAlive; -import net.minecraft.server.v1_6_R3.Packet101CloseWindow; -import net.minecraft.server.v1_6_R3.Packet102WindowClick; -import net.minecraft.server.v1_6_R3.Packet103SetSlot; -import net.minecraft.server.v1_6_R3.Packet106Transaction; -import net.minecraft.server.v1_6_R3.Packet107SetCreativeSlot; -import net.minecraft.server.v1_6_R3.Packet108ButtonClick; -import net.minecraft.server.v1_6_R3.Packet10Flying; -import net.minecraft.server.v1_6_R3.Packet130UpdateSign; -import net.minecraft.server.v1_6_R3.Packet13PlayerLookMove; -import net.minecraft.server.v1_6_R3.Packet14BlockDig; -import net.minecraft.server.v1_6_R3.Packet15Place; -import net.minecraft.server.v1_6_R3.Packet16BlockItemSwitch; -import net.minecraft.server.v1_6_R3.Packet18ArmAnimation; -import net.minecraft.server.v1_6_R3.Packet19EntityAction; -import net.minecraft.server.v1_6_R3.Packet202Abilities; -import net.minecraft.server.v1_6_R3.Packet203TabComplete; -import net.minecraft.server.v1_6_R3.Packet204LocaleAndViewDistance; -import net.minecraft.server.v1_6_R3.Packet205ClientCommand; -import net.minecraft.server.v1_6_R3.Packet250CustomPayload; -import net.minecraft.server.v1_6_R3.Packet255KickDisconnect; -import net.minecraft.server.v1_6_R3.Packet27PlayerInput; -import net.minecraft.server.v1_6_R3.Packet39AttachEntity; -import net.minecraft.server.v1_6_R3.Packet3Chat; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; -import net.minecraft.server.v1_6_R3.Packet53BlockChange; -import net.minecraft.server.v1_6_R3.Packet6SpawnPosition; -import net.minecraft.server.v1_6_R3.Packet7UseEntity; -import net.minecraft.server.v1_6_R3.Packet9Respawn; -import net.minecraft.server.v1_6_R3.PlayerConnection; -import net.minecraft.server.v1_6_R3.PlayerInventory; -import net.minecraft.server.v1_6_R3.ReportedException; -import net.minecraft.server.v1_6_R3.SharedConstants; -import net.minecraft.server.v1_6_R3.Slot; -import net.minecraft.server.v1_6_R3.TileEntity; -import net.minecraft.server.v1_6_R3.TileEntityBeacon; -import net.minecraft.server.v1_6_R3.TileEntityCommand; -import net.minecraft.server.v1_6_R3.TileEntitySign; -import net.minecraft.server.v1_6_R3.Vec3D; -import net.minecraft.server.v1_6_R3.WorldServer; - -import org.apache.commons.lang3.StringUtils; - -// CraftBukkit start -import java.io.UnsupportedEncodingException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import java.util.HashSet; - -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventoryView; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_6_R3.util.LazyPlayerSet; -import org.bukkit.craftbukkit.v1_6_R3.util.Waitable; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; - -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.entity.Player; -import org.bukkit.event.Event; -import org.bukkit.event.block.Action; -import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.inventory.ClickType; -import org.bukkit.event.inventory.CraftItemEvent; -import org.bukkit.event.inventory.InventoryAction; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryCreativeEvent; -import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.inventory.InventoryType.SlotType; -import org.bukkit.event.player.AsyncPlayerChatEvent; -import org.bukkit.event.player.PlayerAnimationEvent; -import org.bukkit.event.player.PlayerChatEvent; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerItemHeldEvent; -import org.bukkit.event.player.PlayerKickEvent; -import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerTeleportEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; -import org.bukkit.event.player.PlayerToggleSneakEvent; -import org.bukkit.event.player.PlayerToggleSprintEvent; -import org.bukkit.inventory.CraftingInventory; -import org.bukkit.inventory.InventoryView; -// CraftBukkit end - -public class PlayerConnection extends Connection { - - public final INetworkManager networkManager; - private final MinecraftServer minecraftServer; - public boolean disconnected; - public EntityPlayer player; - private int e; - private int f; - private boolean g; - private int h; - private long i; - private static Random j = new Random(); - private long k; - private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); // CraftBukkit - multithreaded field - private int x = 0; - private double y; - private double z; - private double p; - public boolean checkMovement = true; // CraftBukkit - private -> public - private IntHashMap r = new IntHashMap(); - - public PlayerConnection(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) { - this.minecraftServer = minecraftserver; - this.networkManager = inetworkmanager; - inetworkmanager.a(this); - this.player = entityplayer; - entityplayer.playerConnection = this; - - // CraftBukkit start - this.server = minecraftserver.server; - } - - private final org.bukkit.craftbukkit.v1_6_R3.CraftServer server; - private int lastTick = MinecraftServer.currentTick; - private int lastDropTick = MinecraftServer.currentTick; - private int dropCount = 0; - private static final int PLACE_DISTANCE_SQUARED = 6 * 6; - - // Get position of last block hit for BlockDamageLevel.STOPPED - private double lastPosX = Double.MAX_VALUE; - private double lastPosY = Double.MAX_VALUE; - private double lastPosZ = Double.MAX_VALUE; - private float lastPitch = Float.MAX_VALUE; - private float lastYaw = Float.MAX_VALUE; - private boolean justTeleported = false; - - // For the packet15 hack :( - Long lastPacket; - - // Store the last block right clicked and what type it was - private int lastMaterial; - - public CraftPlayer getPlayer() { - return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); - } - private final static HashSet invalidItems = new HashSet(java.util.Arrays.asList(8, 9, 10, 11, 26, 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 95, 104, 105, 115, 117, 118, 119, 125, 127, 132, 137, 140, 141, 142, 144)); // TODO: Check after every update. - // CraftBukkit end - - public void e() { - this.g = false; - ++this.e; - this.minecraftServer.methodProfiler.a("packetflow"); - this.networkManager.b(); - this.minecraftServer.methodProfiler.c("keepAlive"); - if ((long) this.e - this.k > 20L) { - this.k = (long) this.e; - this.i = System.nanoTime() / 1000000L; - this.h = j.nextInt(); - this.sendPacket(new Packet0KeepAlive(this.h)); - } - - // CraftBukkit start - for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; - /* Use thread-safe field access instead - if (this.m > 0) { - --this.m; - } - */ - // CraftBukkit end - - if (this.x > 0) { - --this.x; - } - - this.minecraftServer.methodProfiler.c("playerTick"); - this.minecraftServer.methodProfiler.b(); - } - - public void disconnect(String s) { - if (!this.disconnected) { - // CraftBukkit start - String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game."; - - PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage); - - if (this.server.getServer().isRunning()) { - this.server.getPluginManager().callEvent(event); - } - - if (event.isCancelled()) { - // Do not kick the player - return; - } - // Send the possibly modified leave message - s = event.getReason(); - // CraftBukkit end - - this.player.l(); - this.sendPacket(new Packet255KickDisconnect(s)); - this.networkManager.d(); - - // CraftBukkit start - leaveMessage = event.getLeaveMessage(); - if (leaveMessage != null && leaveMessage.length() > 0) { - this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(leaveMessage)); - } - // CraftBukkit end - - this.minecraftServer.getPlayerList().disconnect(this.player); - this.disconnected = true; - } - } - - public void a(Packet27PlayerInput packet27playerinput) { - this.player.a(packet27playerinput.d(), packet27playerinput.f(), packet27playerinput.g(), packet27playerinput.h()); - } - - public void a(Packet10Flying packet10flying) { - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - - this.g = true; - if (!this.player.viewingCredits) { - double d0; - - if (!this.checkMovement) { - d0 = packet10flying.y - this.z; - if (packet10flying.x == this.y && d0 * d0 < 0.01D && packet10flying.z == this.p) { - this.checkMovement = true; - } - } - - // CraftBukkit start - Player player = this.getPlayer(); - Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location. - Location to = player.getLocation().clone(); // Start off the To location as the Players current location. - - // If the packet contains movement information then we update the To location with the correct XYZ. - if (packet10flying.hasPos && !(packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D)) { - to.setX(packet10flying.x); - to.setY(packet10flying.y); - to.setZ(packet10flying.z); - } - - // If the packet contains look information then we update the To location with the correct Yaw & Pitch. - if (packet10flying.hasLook) { - to.setYaw(packet10flying.yaw); - to.setPitch(packet10flying.pitch); - } - - // Prevent 40 event-calls for less than a single pixel of movement >.> - double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + Math.pow(this.lastPosZ - to.getZ(), 2); - float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch()); - - if ((delta > 1f / 256 || deltaAngle > 10f) && (this.checkMovement && !this.player.dead)) { - this.lastPosX = to.getX(); - this.lastPosY = to.getY(); - this.lastPosZ = to.getZ(); - this.lastYaw = to.getYaw(); - this.lastPitch = to.getPitch(); - - // Skip the first time we do this - if (from.getX() != Double.MAX_VALUE) { - PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); - this.server.getPluginManager().callEvent(event); - - // If the event is cancelled we move the player back to their old location. - if (event.isCancelled()) { - this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(from.getX(), from.getY() + 1.6200000047683716D, from.getY(), from.getZ(), from.getYaw(), from.getPitch(), false)); - return; - } - - /* If a Plugin has changed the To destination then we teleport the Player - there to avoid any 'Moved wrongly' or 'Moved too quickly' errors. - We only do this if the Event was not cancelled. */ - if (!to.equals(event.getTo()) && !event.isCancelled()) { - this.player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); - return; - } - - /* Check to see if the Players Location has some how changed during the call of the event. - This can happen due to a plugin teleporting the player instead of using .setTo() */ - if (!from.equals(this.getPlayer().getLocation()) && this.justTeleported) { - this.justTeleported = false; - return; - } - } - } - - if (Double.isNaN(packet10flying.x) || Double.isNaN(packet10flying.y) || Double.isNaN(packet10flying.z) || Double.isNaN(packet10flying.stance)) { - player.teleport(player.getWorld().getSpawnLocation(), PlayerTeleportEvent.TeleportCause.UNKNOWN); - System.err.println(player.getName() + " was caught trying to crash the server with an invalid position."); - player.kickPlayer("Nope!"); - return; - } - - if (this.checkMovement && !this.player.dead) { - // CraftBukkit end - double d1; - double d2; - double d3; - - if (this.player.vehicle != null) { - float f = this.player.yaw; - float f1 = this.player.pitch; - - this.player.vehicle.W(); - d1 = this.player.locX; - d2 = this.player.locY; - d3 = this.player.locZ; - if (packet10flying.hasLook) { - f = packet10flying.yaw; - f1 = packet10flying.pitch; - } - - this.player.onGround = packet10flying.g; - this.player.h(); - this.player.X = 0.0F; - this.player.setLocation(d1, d2, d3, f, f1); - if (this.player.vehicle != null) { - this.player.vehicle.W(); - } - - this.minecraftServer.getPlayerList().d(this.player); - if (this.checkMovement) { - this.y = this.player.locX; - this.z = this.player.locY; - this.p = this.player.locZ; - } - - worldserver.playerJoinedWorld(this.player); - return; - } - - if (this.player.isSleeping()) { - this.player.h(); - this.player.setLocation(this.y, this.z, this.p, this.player.yaw, this.player.pitch); - worldserver.playerJoinedWorld(this.player); - return; - } - - d0 = this.player.locY; - this.y = this.player.locX; - this.z = this.player.locY; - this.p = this.player.locZ; - d1 = this.player.locX; - d2 = this.player.locY; - d3 = this.player.locZ; - float f2 = this.player.yaw; - float f3 = this.player.pitch; - - if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) { - packet10flying.hasPos = false; - } - - double d4; - - if (packet10flying.hasPos) { - d1 = packet10flying.x; - d2 = packet10flying.y; - d3 = packet10flying.z; - d4 = packet10flying.stance - packet10flying.y; - if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) { - this.disconnect("Illegal stance"); - this.minecraftServer.getLogger().warning(this.player.getName() + " had an illegal stance: " + d4); - return; - } - - if (Math.abs(packet10flying.x) > 3.2E7D || Math.abs(packet10flying.z) > 3.2E7D) { - // CraftBukkit - teleport to previous position instead of kicking, players get stuck - this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch); - return; - } - } - - if (packet10flying.hasLook) { - f2 = packet10flying.yaw; - f3 = packet10flying.pitch; - } - - this.player.h(); - this.player.X = 0.0F; - this.player.setLocation(this.y, this.z, this.p, f2, f3); - if (!this.checkMovement) { - return; - } - - d4 = d1 - this.player.locX; - double d5 = d2 - this.player.locY; - double d6 = d3 - this.player.locZ; - // CraftBukkit start - min to max - double d7 = Math.max(Math.abs(d4), Math.abs(this.player.motX)); - double d8 = Math.max(Math.abs(d5), Math.abs(this.player.motY)); - double d9 = Math.max(Math.abs(d6), Math.abs(this.player.motZ)); - // CraftBukkit end - double d10 = d7 * d7 + d8 * d8 + d9 * d9; - - if (d10 > 100.0D && this.checkMovement && (!this.minecraftServer.K() || !this.minecraftServer.J().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports - this.minecraftServer.getLogger().warning(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + d8 + ", " + d9 + ")"); - this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch); - return; - } - - float f4 = 0.0625F; - boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty(); - - if (this.player.onGround && !packet10flying.g && d5 > 0.0D) { - this.player.a(0.2F); - } - - this.player.move(d4, d5, d6); - this.player.onGround = packet10flying.g; - this.player.checkMovement(d4, d5, d6); - double d11 = d5; - - d4 = d1 - this.player.locX; - d5 = d2 - this.player.locY; - if (d5 > -0.5D || d5 < 0.5D) { - d5 = 0.0D; - } - - d6 = d3 - this.player.locZ; - d10 = d4 * d4 + d5 * d5 + d6 * d6; - boolean flag1 = false; - - if (d10 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) { - flag1 = true; - this.minecraftServer.getLogger().warning(this.player.getName() + " moved wrongly!"); - } - - this.player.setLocation(d1, d2, d3, f2, f3); - boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty(); - - if (flag && (flag1 || !flag2) && !this.player.isSleeping()) { - this.a(this.y, this.z, this.p, f2, f3); - return; - } - - AxisAlignedBB axisalignedbb = this.player.boundingBox.clone().grow((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D); - - if (!this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !worldserver.c(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode - if (d11 >= -0.03125D) { - ++this.f; - if (this.f > 80) { - this.minecraftServer.getLogger().warning(this.player.getName() + " was kicked for floating too long!"); - this.disconnect("Flying is not enabled on this server"); - return; - } - } - } else { - this.f = 0; - } - - this.player.onGround = packet10flying.g; - this.minecraftServer.getPlayerList().d(this.player); - if (this.player.playerInteractManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode. - this.player.b(this.player.locY - d0, packet10flying.g); - } else if (this.e % 20 == 0) { - this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch); - } - } - } - - public void a(double d0, double d1, double d2, float f, float f1) { - // CraftBukkit start - Delegate to teleport(Location) - Player player = this.getPlayer(); - Location from = player.getLocation(); - Location to = new Location(this.getPlayer().getWorld(), d0, d1, d2, f, f1); - PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.UNKNOWN); - this.server.getPluginManager().callEvent(event); - - from = event.getFrom(); - to = event.isCancelled() ? from : event.getTo(); - - this.teleport(to); - } - - public void teleport(Location dest) { - double d0, d1, d2; - float f, f1; - - d0 = dest.getX(); - d1 = dest.getY(); - d2 = dest.getZ(); - f = dest.getYaw(); - f1 = dest.getPitch(); - - // TODO: make sure this is the best way to address this. - if (Float.isNaN(f)) { - f = 0; - } - - if (Float.isNaN(f1)) { - f1 = 0; - } - - this.lastPosX = d0; - this.lastPosY = d1; - this.lastPosZ = d2; - this.lastYaw = f; - this.lastPitch = f1; - this.justTeleported = true; - // CraftBukkit end - - this.checkMovement = false; - this.y = d0; - this.z = d1; - this.p = d2; - this.player.setLocation(d0, d1, d2, f, f1); - this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false)); - } - - public void a(Packet14BlockDig packet14blockdig) { - if (this.player.dead) return; // CraftBukkit - - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - - this.player.u(); - if (packet14blockdig.e == 4) { - // CraftBukkit start - // If the ticks aren't the same then the count starts from 0 and we update the lastDropTick. - if (this.lastDropTick != MinecraftServer.currentTick) { - this.dropCount = 0; - this.lastDropTick = MinecraftServer.currentTick; - } else { - // Else we increment the drop count and check the amount. - this.dropCount++; - if (this.dropCount >= 20) { - this.minecraftServer.getLogger().warning(this.player.getName() + " dropped their items too quickly!"); - this.disconnect("You dropped your items too quickly (Hacking?)"); - return; - } - } - // CraftBukkit end - this.player.a(false); - } else if (packet14blockdig.e == 3) { - this.player.a(true); - } else if (packet14blockdig.e == 5) { - this.player.bt(); - } else { - boolean flag = false; - - if (packet14blockdig.e == 0) { - flag = true; - } - - if (packet14blockdig.e == 1) { - flag = true; - } - - if (packet14blockdig.e == 2) { - flag = true; - } - - int i = packet14blockdig.a; - int j = packet14blockdig.b; - int k = packet14blockdig.c; - - if (flag) { - double d0 = this.player.locX - ((double) i + 0.5D); - double d1 = this.player.locY - ((double) j + 0.5D) + 1.5D; - double d2 = this.player.locZ - ((double) k + 0.5D); - double d3 = d0 * d0 + d1 * d1 + d2 * d2; - - if (d3 > 36.0D) { - return; - } - - if (j >= this.minecraftServer.getMaxBuildHeight()) { - return; - } - } - - if (packet14blockdig.e == 0) { - // CraftBukkit start - if (!this.minecraftServer.a(worldserver, i, j, k, this.player)) { - this.player.playerInteractManager.dig(i, j, k, packet14blockdig.face); - } else { - CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, packet14blockdig.face, this.player.inventory.getItemInHand()); - this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); - // Update any tile entity data for this block - TileEntity tileentity = worldserver.getTileEntity(i, j, k); - if (tileentity != null) { - this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); - } - // CraftBukkit end - } - } else if (packet14blockdig.e == 2) { - this.player.playerInteractManager.a(i, j, k); - if (worldserver.getTypeId(i, j, k) != 0) { - this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); - } - } else if (packet14blockdig.e == 1) { - this.player.playerInteractManager.c(i, j, k); - if (worldserver.getTypeId(i, j, k) != 0) { - this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); - } - } - } - } - - public void a(Packet15Place packet15place) { - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - - // CraftBukkit start - if (this.player.dead) return; - - // This is a horrible hack needed because the client sends 2 packets on 'right mouse click' - // aimed at a block. We shouldn't need to get the second packet if the data is handled - // but we cannot know what the client will do, so we might still get it - // - // If the time between packets is small enough, and the 'signature' similar, we discard the - // second one. This sadly has to remain until Mojang makes their packets saner. :( - // -- Grum - - this.player.u(); - if (packet15place.getFace() == 255) { - if (packet15place.getItemStack() != null && packet15place.getItemStack().id == this.lastMaterial && this.lastPacket != null && packet15place.timestamp - this.lastPacket < 100) { - this.lastPacket = null; - return; - } - } else { - this.lastMaterial = packet15place.getItemStack() == null ? -1 : packet15place.getItemStack().id; - this.lastPacket = packet15place.timestamp; - } - - // CraftBukkit - if rightclick decremented the item, always send the update packet. - // this is not here for CraftBukkit's own functionality; rather it is to fix - // a notch bug where the item doesn't update correctly. - boolean always = false; - - // CraftBukkit end - - ItemStack itemstack = this.player.inventory.getItemInHand(); - boolean flag = false; - int i = packet15place.d(); - int j = packet15place.f(); - int k = packet15place.g(); - int l = packet15place.getFace(); - - if (packet15place.getFace() == 255) { - if (itemstack == null) { - return; - } - - // CraftBukkit start - int itemstackAmount = itemstack.count; - org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack); - if (event.useItemInHand() != Event.Result.DENY) { - this.player.playerInteractManager.useItem(this.player, this.player.world, itemstack); - } - - // CraftBukkit - notch decrements the counter by 1 in the above method with food, - // snowballs and so forth, but he does it in a place that doesn't cause the - // inventory update packet to get sent - always = (itemstack.count != itemstackAmount); - // CraftBukkit end - } else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) { - this.player.playerConnection.sendPacket(new Packet3Chat(ChatMessage.b("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())}).a(EnumChatFormat.RED))); - flag = true; - } else { - // CraftBukkit start - Check if we can actually do something over this large a distance - Location eyeLoc = this.getPlayer().getEyeLocation(); - if (Math.pow(eyeLoc.getX() - i, 2) + Math.pow(eyeLoc.getY() - j, 2) + Math.pow(eyeLoc.getZ() - k, 2) > PLACE_DISTANCE_SQUARED) { - return; - } - - this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.k(), packet15place.l()); - // CraftBukkit end - - flag = true; - } - - if (flag) { - this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); - if (l == 0) { - --j; - } - - if (l == 1) { - ++j; - } - - if (l == 2) { - --k; - } - - if (l == 3) { - ++k; - } - - if (l == 4) { - --i; - } - - if (l == 5) { - ++i; - } - - this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver)); - } - - itemstack = this.player.inventory.getItemInHand(); - if (itemstack != null && itemstack.count == 0) { - this.player.inventory.items[this.player.inventory.itemInHandIndex] = null; - itemstack = null; - } - - if (itemstack == null || itemstack.n() == 0) { - this.player.h = true; - this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]); - Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex); - - this.player.activeContainer.b(); - this.player.h = false; - // CraftBukkit - TODO CHECK IF NEEDED -- new if structure might not need 'always'. Kept it in for now, but may be able to remove in future - if (!ItemStack.matches(this.player.inventory.getItemInHand(), packet15place.getItemStack()) || always) { - this.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, slot.g, this.player.inventory.getItemInHand())); - } - } - } - - public void a(String s, Object[] aobject) { - if (this.disconnected) return; // CraftBukkit - Rarely it would send a disconnect line twice - - this.minecraftServer.getLogger().info(this.player.getName() + " lost connection: " + s); - // CraftBukkit start - We need to handle custom quit messages - String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); - if ((quitMessage != null) && (quitMessage.length() > 0)) { - this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(quitMessage)); - } - // CraftBukkit end - this.disconnected = true; - if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) { - this.minecraftServer.getLogger().info("Stopping singleplayer server as player logged out"); - this.minecraftServer.safeShutdown(); - } - } - - public void onUnhandledPacket(Packet packet) { - if (this.disconnected) return; // CraftBukkit - this.minecraftServer.getLogger().warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass()); - this.disconnect("Protocol error, unexpected packet"); - } - - public void sendPacket(Packet packet) { - if (packet instanceof Packet3Chat) { - Packet3Chat packet3chat = (Packet3Chat) packet; - int i = this.player.getChatFlags(); - - if (i == 2) { - return; - } - - if (i == 1 && !packet3chat.isServer()) { - return; - } - } - - // CraftBukkit start - if (packet == null) { - return; - } else if (packet instanceof Packet6SpawnPosition) { - Packet6SpawnPosition packet6 = (Packet6SpawnPosition) packet; - this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z); - } - // CraftBukkit end - - try { - this.networkManager.queue(packet); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); - - crashreportsystemdetails.a("Packet ID", (Callable) (new CrashReportConnectionPacketID(this, packet))); - crashreportsystemdetails.a("Packet class", (Callable) (new CrashReportConnectionPacketClass(this, packet))); - throw new ReportedException(crashreport); - } - } - - public void a(Packet16BlockItemSwitch packet16blockitemswitch) { - // CraftBukkit start - if (this.player.dead) return; - - if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) { - PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex); - this.server.getPluginManager().callEvent(event); - if (event.isCancelled()) { - this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex)); - this.player.u(); - return; - } - // CraftBukkit end - - this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex; - this.player.u(); - } else { - this.minecraftServer.getLogger().warning(this.player.getName() + " tried to set an invalid carried item"); - this.disconnect("Nope!"); // CraftBukkit - } - } - - public void a(Packet3Chat packet3chat) { - if (this.player.getChatFlags() == 2) { - this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED))); - } else { - this.player.u(); - String s = packet3chat.message; - - if (s.length() > 100) { - // CraftBukkit start - if (packet3chat.a_()) { - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { - PlayerConnection.this.disconnect("Chat message too long"); - return null; - } - }; - - this.minecraftServer.processQueue.add(waitable); - - try { - waitable.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - throw new RuntimeException(e); - } - } else { - this.disconnect("Chat message too long"); - } - // CraftBukkit end - } else { - s = StringUtils.normalizeSpace(s); - - for (int i = 0; i < s.length(); ++i) { - if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { - // CraftBukkit start - if (packet3chat.a_()) { - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { - PlayerConnection.this.disconnect("Illegal characters in chat"); - return null; - } - }; - - this.minecraftServer.processQueue.add(waitable); - - try { - waitable.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - throw new RuntimeException(e); - } - } else { - this.disconnect("Illegal characters in chat"); - } - // CraftBukkit end - return; - } - } - - // CraftBukkit start - if (this.player.getChatFlags() == 1 && !s.startsWith("/")) { - this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED))); - return; - } - - this.chat(s, packet3chat.a_()); - - // This section stays because it is only applicable to packets - if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam - if (packet3chat.a_()) { - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { - PlayerConnection.this.disconnect("disconnect.spam"); - return null; - } - }; - - this.minecraftServer.processQueue.add(waitable); - - try { - waitable.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } catch (ExecutionException e) { - throw new RuntimeException(e); - } - } else { - this.disconnect("disconnect.spam"); - } - } - } - } - } - - public void chat(String s, boolean async) { - if (!this.player.dead) { - if (s.length() == 0) { - this.minecraftServer.getLogger().warning(this.player.getName() + " tried to send an empty message"); - return; - } - - if (getPlayer().isConversing()) { - getPlayer().acceptConversationInput(s); - return; - } - - if (s.startsWith("/")) { - this.handleCommand(s); - return; - } else { - Player player = this.getPlayer(); - AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet()); - this.server.getPluginManager().callEvent(event); - - if (PlayerChatEvent.getHandlerList().getRegisteredListeners().length != 0) { - // Evil plugins still listening to deprecated event - final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), event.getRecipients()); - queueEvent.setCancelled(event.isCancelled()); - Waitable waitable = new Waitable() { - @Override - protected Object evaluate() { - org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent); - - if (queueEvent.isCancelled()) { - return null; - } - - String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), queueEvent.getMessage()); - PlayerConnection.this.minecraftServer.console.sendMessage(message); - if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) { - for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) { - ((EntityPlayer) player).sendMessage(ChatMessage.d(message)); - } - } else { - for (Player player : queueEvent.getRecipients()) { - player.sendMessage(message); - } - } - return null; - }}; - if (async) { - minecraftServer.processQueue.add(waitable); - } else { - waitable.run(); - } - try { - waitable.get(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); // This is proper habit for java. If we aren't handling it, pass it on! - } catch (ExecutionException e) { - throw new RuntimeException("Exception processing chat event", e.getCause()); - } - } else { - if (event.isCancelled()) { - return; - } - - s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()); - minecraftServer.console.sendMessage(s); - if (((LazyPlayerSet) event.getRecipients()).isLazy()) { - for (Object recipient : minecraftServer.getPlayerList().players) { - ((EntityPlayer) recipient).sendMessage(ChatMessage.d(s)); - } - } else { - for (Player recipient : event.getRecipients()) { - recipient.sendMessage(s); - } - } - } - } - } - - return; - } - // CraftBukkit end - - private void handleCommand(String s) { - // CraftBukkit start - CraftPlayer player = this.getPlayer(); - - PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet()); - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - - try { - this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit - if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) { - return; - } - } catch (org.bukkit.command.CommandException ex) { - player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command"); - java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - return; - } - // CraftBukkit end - - /* CraftBukkit start - No longer needed as we have already handled it in server.dispatchServerCommand above. - this.minecraftServer.getCommandHandler().a(this.player, s); - // CraftBukkit end */ - } - - public void a(Packet18ArmAnimation packet18armanimation) { - if (this.player.dead) return; // CraftBukkit - - if (packet18armanimation.b == 1) { - // CraftBukkit start - Raytrace to look for 'rogue armswings' - float f = 1.0F; - float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f; - float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f; - double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f; - double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D - (double) this.player.height; - double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f; - Vec3D vec3d = this.player.world.getVec3DPool().create(d0, d1, d2); - - float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); - float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F); - float f5 = -MathHelper.cos(-f1 * 0.017453292F); - float f6 = MathHelper.sin(-f1 * 0.017453292F); - float f7 = f4 * f5; - float f8 = f3 * f5; - double d3 = 5.0D; - Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); - MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true); - - if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.TILE) { - CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand()); - } - - // Arm swing animation - PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer()); - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) return; - // CraftBukkit end - - this.player.aV(); - } - } - - public void a(Packet19EntityAction packet19entityaction) { - // CraftBukkit start - if (this.player.dead) return; - - this.player.u(); - if (packet19entityaction.animation == 1 || packet19entityaction.animation == 2) { - PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packet19entityaction.animation == 1); - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - } - - if (packet19entityaction.animation == 4 || packet19entityaction.animation == 5) { - PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this.getPlayer(), packet19entityaction.animation == 4); - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { - return; - } - } - // CraftBukkit end - - if (packet19entityaction.animation == 1) { - this.player.setSneaking(true); - } else if (packet19entityaction.animation == 2) { - this.player.setSneaking(false); - } else if (packet19entityaction.animation == 4) { - this.player.setSprinting(true); - } else if (packet19entityaction.animation == 5) { - this.player.setSprinting(false); - } else if (packet19entityaction.animation == 3) { - this.player.a(false, true, true); - // this.checkMovement = false; // CraftBukkit - this is handled in teleport - } else if (packet19entityaction.animation == 6) { - if (this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) { - ((EntityHorse) this.player.vehicle).u(packet19entityaction.c); - } - } else if (packet19entityaction.animation == 7 && this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) { - ((EntityHorse) this.player.vehicle).f(this.player); - } - } - - public void a(Packet255KickDisconnect packet255kickdisconnect) { - this.networkManager.a("disconnect.quitting", new Object[0]); - } - - public int lowPriorityCount() { - return this.networkManager.e(); - } - - public void a(Packet7UseEntity packet7useentity) { - if (this.player.dead) return; // CraftBukkit - - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - Entity entity = worldserver.getEntity(packet7useentity.target); - - this.player.u(); - if (entity != null) { - boolean flag = this.player.o(entity); - double d0 = 36.0D; - - if (!flag) { - d0 = 9.0D; - } - - if (this.player.e(entity) < d0) { - ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit - if (packet7useentity.action == 0) { - // CraftBukkit start - boolean triggerTagUpdate = itemInHand != null && itemInHand.id == Item.NAME_TAG.id && entity instanceof EntityInsentient; - boolean triggerChestUpdate = itemInHand != null && itemInHand.id == Block.CHEST.id && entity instanceof EntityHorse; - boolean triggerLeashUpdate = itemInHand != null && itemInHand.id == Item.LEASH.id && entity instanceof EntityInsentient; - PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity()); - this.server.getPluginManager().callEvent(event); - - if (triggerLeashUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Item.LEASH.id)) { - // Refresh the current leash state - this.sendPacket(new Packet39AttachEntity(1, entity, ((EntityInsentient) entity).getLeashHolder())); - } - - if (triggerTagUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Item.NAME_TAG.id)) { - // Refresh the current entity metadata - this.sendPacket(new Packet40EntityMetadata(entity.id, entity.datawatcher, true)); - } - - if (triggerChestUpdate && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().id != Block.CHEST.id)) { - this.sendPacket(new Packet40EntityMetadata(entity.id, entity.datawatcher, true)); - } - - if (event.isCancelled()) { - return; - } - // CraftBukkit end - this.player.p(entity); - // CraftBukkit start - Update the client if the item is an infinite one - if (itemInHand != null && itemInHand.count <= -1) { - this.player.updateInventory(this.player.activeContainer); - } - } else if (packet7useentity.action == 1) { - // CraftBukkit - Check for player - if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow) || (entity == this.player)) { - String type = entity.getClass().getSimpleName(); - disconnect("Attacking an " + type + " is not permitted"); - System.out.println("Player " + player.getName() + " tried to attack an " + type + ", so I have disconnected them for exploiting."); - return; - } - - this.player.attack(entity); - - if (itemInHand != null && itemInHand.count <= -1) { - this.player.updateInventory(this.player.activeContainer); - } - // CraftBukkit end - } - } - } - } - - public void a(Packet205ClientCommand packet205clientcommand) { - this.player.u(); - if (packet205clientcommand.a == 1) { - if (this.player.viewingCredits) { - this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management - } else if (this.player.p().getWorldData().isHardcore()) { - if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) { - this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); - this.minecraftServer.R(); - } else { - BanEntry banentry = new BanEntry(this.player.getName()); - - banentry.setReason("Death in Hardcore"); - this.minecraftServer.getPlayerList().getNameBans().add(banentry); - this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); - } - } else { - if (this.player.getHealth() > 0.0F) { - return; - } - - this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, false); - } - } - } - - public boolean b() { - return true; - } - - public void a(Packet9Respawn packet9respawn) {} - - public void handleContainerClose(Packet101CloseWindow packet101closewindow) { - if (this.player.dead) return; // CraftBukkit - - if (packet101closewindow.a == player.activeContainer.windowId) - { - CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit - - this.player.k(); - } - } - - public void a(Packet102WindowClick packet102windowclick) { - if (this.player.dead) return; // CraftBukkit - - this.player.u(); - if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) { - // CraftBukkit start - Call InventoryClickEvent - if (packet102windowclick.slot < -1 && packet102windowclick.slot != -999) { - return; - } - - InventoryView inventory = this.player.activeContainer.getBukkitView(); - SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot); - - InventoryClickEvent event = null; - ClickType click = ClickType.UNKNOWN; - InventoryAction action = InventoryAction.UNKNOWN; - - ItemStack itemstack = null; - - if (packet102windowclick.slot == -1) { - type = SlotType.OUTSIDE; // override - click = packet102windowclick.button == 0 ? ClickType.WINDOW_BORDER_LEFT : ClickType.WINDOW_BORDER_RIGHT; - action = InventoryAction.NOTHING; - } else if (packet102windowclick.shift == 0) { - if (packet102windowclick.button == 0) { - click = ClickType.LEFT; - } else if (packet102windowclick.button == 1) { - click = ClickType.RIGHT; - } - if (packet102windowclick.button == 0 || packet102windowclick.button == 1) { - action = InventoryAction.NOTHING; // Don't want to repeat ourselves - if (packet102windowclick.slot == -999) { - if (player.inventory.getCarried() != null) { - action = packet102windowclick.button == 0 ? InventoryAction.DROP_ALL_CURSOR : InventoryAction.DROP_ONE_CURSOR; - } - } else { - Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); - if (slot != null) { - ItemStack clickedItem = slot.getItem(); - ItemStack cursor = player.inventory.getCarried(); - if (clickedItem == null) { - if (cursor != null) { - action = packet102windowclick.button == 0 ? InventoryAction.PLACE_ALL : InventoryAction.PLACE_ONE; - } - } else if (slot.a(player)) { // Should be Slot.isPlayerAllowed - if (cursor == null) { - action = packet102windowclick.button == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF; - } else if (slot.isAllowed(cursor)) { // Should be Slot.isItemAllowed - if (clickedItem.doMaterialsMatch(cursor) && ItemStack.equals(clickedItem, cursor)) { - int toPlace = packet102windowclick.button == 0 ? cursor.count : 1; - toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.count); - toPlace = Math.min(toPlace, slot.inventory.getMaxStackSize() - clickedItem.count); - if (toPlace == 1) { - action = InventoryAction.PLACE_ONE; - } else if (toPlace == cursor.count) { - action = InventoryAction.PLACE_ALL; - } else if (toPlace < 0) { - action = toPlace != -1 ? InventoryAction.PICKUP_SOME : InventoryAction.PICKUP_ONE; // this happens with oversized stacks - } else if (toPlace != 0) { - action = InventoryAction.PLACE_SOME; - } - } else if (cursor.count <= slot.a()) { // Should be Slot.getMaxStackSize() - action = InventoryAction.SWAP_WITH_CURSOR; - } - } else if (cursor.id == clickedItem.id && (!cursor.usesData() || cursor.getData() == clickedItem.getData()) && ItemStack.equals(cursor, clickedItem)) { - if (clickedItem.count >= 0) { - if (clickedItem.count + cursor.count <= cursor.getMaxStackSize()) { - // As of 1.5, this is result slots only - action = InventoryAction.PICKUP_ALL; - } - } - } - } - } - } - } - } else if (packet102windowclick.shift == 1) { - if (packet102windowclick.button == 0) { - click = ClickType.SHIFT_LEFT; - } else if (packet102windowclick.button == 1) { - click = ClickType.SHIFT_RIGHT; - } - if (packet102windowclick.button == 0 || packet102windowclick.button == 1) { - if (packet102windowclick.slot < 0) { - action = InventoryAction.NOTHING; - } else { - Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); - if (slot != null && slot.a(this.player) && slot.e()) { // Should be Slot.hasItem() - action = InventoryAction.MOVE_TO_OTHER_INVENTORY; - } else { - action = InventoryAction.NOTHING; - } - } - } - } else if (packet102windowclick.shift == 2) { - if (packet102windowclick.button >= 0 && packet102windowclick.button < 9) { - click = ClickType.NUMBER_KEY; - Slot clickedSlot = this.player.activeContainer.getSlot(packet102windowclick.slot); - if (clickedSlot.a(player)) { - ItemStack hotbar = this.player.inventory.getItem(packet102windowclick.button); - boolean canCleanSwap = hotbar == null || (clickedSlot.inventory == player.inventory && clickedSlot.isAllowed(hotbar)); // the slot will accept the hotbar item - if (clickedSlot.e()) { - if (canCleanSwap) { - action = InventoryAction.HOTBAR_SWAP; - } else { - int firstEmptySlot = player.inventory.j(); // Should be Inventory.firstEmpty() - if (firstEmptySlot > -1) { - action = InventoryAction.HOTBAR_MOVE_AND_READD; - } else { - action = InventoryAction.NOTHING; // This is not sane! Mojang: You should test for other slots of same type - } - } - } else if (!clickedSlot.e() && hotbar != null && clickedSlot.isAllowed(hotbar)) { - action = InventoryAction.HOTBAR_SWAP; - } else { - action = InventoryAction.NOTHING; - } - } else { - action = InventoryAction.NOTHING; - } - // Special constructor for number key - event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button); - } - } else if (packet102windowclick.shift == 3) { - if (packet102windowclick.button == 2) { - click = ClickType.MIDDLE; - if (packet102windowclick.slot == -999) { - action = InventoryAction.NOTHING; - } else { - Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); - if (slot != null && slot.e() && player.abilities.canInstantlyBuild && player.inventory.getCarried() == null) { - action = InventoryAction.CLONE_STACK; - } else { - action = InventoryAction.NOTHING; - } - } - } else { - click = ClickType.UNKNOWN; - action = InventoryAction.UNKNOWN; - } - } else if (packet102windowclick.shift == 4) { - if (packet102windowclick.slot >= 0) { - if (packet102windowclick.button == 0) { - click = ClickType.DROP; - Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); - if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) { - action = InventoryAction.DROP_ONE_SLOT; - } else { - action = InventoryAction.NOTHING; - } - } else if (packet102windowclick.button == 1) { - click = ClickType.CONTROL_DROP; - Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot); - if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) { - action = InventoryAction.DROP_ALL_SLOT; - } else { - action = InventoryAction.NOTHING; - } - } - } else { - // Sane default (because this happens when they are holding nothing. Don't ask why.) - click = ClickType.LEFT; - if (packet102windowclick.button == 1) { - click = ClickType.RIGHT; - } - action = InventoryAction.NOTHING; - } - } else if (packet102windowclick.shift == 5) { - itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, 5, this.player); - } else if (packet102windowclick.shift == 6) { - click = ClickType.DOUBLE_CLICK; - action = InventoryAction.NOTHING; - if (packet102windowclick.slot >= 0 && this.player.inventory.getCarried() != null) { - ItemStack cursor = this.player.inventory.getCarried(); - action = InventoryAction.NOTHING; - // Quick check for if we have any of the item - if (inventory.getTopInventory().contains(cursor.id) || inventory.getBottomInventory().contains(cursor.id)) { - action = InventoryAction.COLLECT_TO_CURSOR; - } - } - } - // TODO check on updates - - if (packet102windowclick.shift != 5) { - if (click == ClickType.NUMBER_KEY) { - event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button); - } else { - event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, click, action); - } - - org.bukkit.inventory.Inventory top = inventory.getTopInventory(); - if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) { - org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe(); - if (recipe != null) { - if (click == ClickType.NUMBER_KEY) { - event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action, packet102windowclick.button); - } else { - event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, click, action); - } - } - } - - server.getPluginManager().callEvent(event); - - switch (event.getResult()) { - case ALLOW: - case DEFAULT: - itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, packet102windowclick.shift, this.player); - break; - case DENY: - /* Needs enum constructor in InventoryAction - if (action.modifiesOtherSlots()) { - - } else { - if (action.modifiesCursor()) { - this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried())); - } - if (action.modifiesClicked()) { - this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem())); - } - }*/ - switch (action) { - // Modified other slots - case PICKUP_ALL: - case MOVE_TO_OTHER_INVENTORY: - case HOTBAR_MOVE_AND_READD: - case HOTBAR_SWAP: - case COLLECT_TO_CURSOR: - case UNKNOWN: - this.player.updateInventory(this.player.activeContainer); - break; - // Modified cursor and clicked - case PICKUP_SOME: - case PICKUP_HALF: - case PICKUP_ONE: - case PLACE_ALL: - case PLACE_SOME: - case PLACE_ONE: - case SWAP_WITH_CURSOR: - this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried())); - this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem())); - break; - // Modified clicked only - case DROP_ALL_SLOT: - case DROP_ONE_SLOT: - this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.activeContainer.windowId, packet102windowclick.slot, this.player.activeContainer.getSlot(packet102windowclick.slot).getItem())); - break; - // Modified cursor only - case DROP_ALL_CURSOR: - case DROP_ONE_CURSOR: - case CLONE_STACK: - this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.player.inventory.getCarried())); - break; - // Nothing - case NOTHING: - break; - } - return; - } - } - // CraftBukkit end - - if (ItemStack.matches(packet102windowclick.item, itemstack)) { - this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)); - this.player.h = true; - this.player.activeContainer.b(); - this.player.broadcastCarriedItem(); - this.player.h = false; - } else { - this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d)); - this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false)); - this.player.activeContainer.a(this.player, false); - ArrayList arraylist = new ArrayList(); - - for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { - arraylist.add(((Slot) this.player.activeContainer.c.get(i)).getItem()); - } - - this.player.a(this.player.activeContainer, arraylist); - - // CraftBukkit start - Send a Set Slot to update the crafting result slot - if (type == SlotType.RESULT && itemstack != null) { - this.player.playerConnection.sendPacket((Packet) (new Packet103SetSlot(this.player.activeContainer.windowId, 0, itemstack))); - } - // CraftBukkit end - } - } - } - - public void a(Packet108ButtonClick packet108buttonclick) { - this.player.u(); - if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) { - this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b); - this.player.activeContainer.b(); - } - } - - public void a(Packet107SetCreativeSlot packet107setcreativeslot) { - if (this.player.playerInteractManager.isCreative()) { - boolean flag = packet107setcreativeslot.slot < 0; - ItemStack itemstack = packet107setcreativeslot.b; - boolean flag1 = packet107setcreativeslot.slot >= 1 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize(); - // CraftBukkit - boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id); - boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; - - // CraftBukkit start - Call click event - if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packet107setcreativeslot.slot).getItem(), packet107setcreativeslot.b))) { // Insist on valid slot - - org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity(); - InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer); - org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packet107setcreativeslot.b); // Should be packet107setcreativeslot.newitem - - SlotType type = SlotType.QUICKBAR; - if (flag) { - type = SlotType.OUTSIDE; - } else if (packet107setcreativeslot.slot < 36) { - if (packet107setcreativeslot.slot >= 5 && packet107setcreativeslot.slot < 9) { - type = SlotType.ARMOR; - } else { - type = SlotType.CONTAINER; - } - } - InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 : packet107setcreativeslot.slot, item); - server.getPluginManager().callEvent(event); - - itemstack = CraftItemStack.asNMSCopy(event.getCursor()); - - switch (event.getResult()) { - case ALLOW: - // Plugin cleared the id / stacksize checks - flag2 = flag3 = true; - break; - case DEFAULT: - break; - case DENY: - // Reset the slot - if (packet107setcreativeslot.slot >= 0) { - this.player.playerConnection.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.slot, this.player.defaultContainer.getSlot(packet107setcreativeslot.slot).getItem())); - this.player.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, null)); - } - return; - } - } - // CraftBukkit end - - if (flag1 && flag2 && flag3) { - if (itemstack == null) { - this.player.defaultContainer.setItem(packet107setcreativeslot.slot, (ItemStack) null); - } else { - this.player.defaultContainer.setItem(packet107setcreativeslot.slot, itemstack); - } - - this.player.defaultContainer.a(this.player, true); - } else if (flag && flag2 && flag3 && this.x < 200) { - this.x += 20; - EntityItem entityitem = this.player.drop(itemstack); - - if (entityitem != null) { - entityitem.c(); - } - } - } - } - - public void a(Packet106Transaction packet106transaction) { - if (this.player.dead) return; // CraftBukkit - Short oshort = (Short) this.r.get(this.player.activeContainer.windowId); - - if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) { - this.player.activeContainer.a(this.player, true); - } - } - - public void a(Packet130UpdateSign packet130updatesign) { - if (this.player.dead) return; // CraftBukkit - - this.player.u(); - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); - - if (worldserver.isLoaded(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z)) { - TileEntity tileentity = worldserver.getTileEntity(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z); - - if (tileentity instanceof TileEntitySign) { - TileEntitySign tileentitysign = (TileEntitySign) tileentity; - - if (!tileentitysign.a() || tileentitysign.b() != this.player) { - this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); - this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); // CraftBukkit - return; - } - } - - int i; - int j; - - for (j = 0; j < 4; ++j) { - boolean flag = true; - - if (packet130updatesign.lines[j].length() > 15) { - flag = false; - } else { - for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { - if (SharedConstants.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { - flag = false; - } - } - } - - if (!flag) { - packet130updatesign.lines[j] = "!?"; - } - } - - if (tileentity instanceof TileEntitySign) { - j = packet130updatesign.x; - int k = packet130updatesign.y; - - i = packet130updatesign.z; - TileEntitySign tileentitysign1 = (TileEntitySign) tileentity; - - // CraftBukkit start - Player player = this.server.getPlayer(this.player); - SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.v1_6_R3.block.CraftBlock) player.getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packet130updatesign.lines); - this.server.getPluginManager().callEvent(event); - - if (!event.isCancelled()) { - for (int l = 0; l < 4; ++l) { - tileentitysign1.lines[l] = event.getLine(l); - if(tileentitysign1.lines[l] == null) { - tileentitysign1.lines[l] = ""; - } - } - tileentitysign1.isEditable = false; - } - // CraftBukkit end - - tileentitysign1.update(); - worldserver.notify(j, k, i); - } - } - } - - public void a(Packet0KeepAlive packet0keepalive) { - if (packet0keepalive.a == this.h) { - int i = (int) (System.nanoTime() / 1000000L - this.i); - - this.player.ping = (this.player.ping * 3 + i) / 4; - } - } - - public boolean a() { - return true; - } - - public void a(Packet202Abilities packet202abilities) { - // CraftBukkit start - if (this.player.abilities.canFly && this.player.abilities.isFlying != packet202abilities.f()) { - PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet202abilities.f()); - this.server.getPluginManager().callEvent(event); - if (!event.isCancelled()) { - this.player.abilities.isFlying = packet202abilities.f(); // Actually set the player's flying status - } - else { - this.player.updateAbilities(); // Tell the player their ability was reverted - } - } - // CraftBukkit end - } - - public void a(Packet203TabComplete packet203tabcomplete) { - StringBuilder stringbuilder = new StringBuilder(); - - String s; - - for (Iterator iterator = this.minecraftServer.a(this.player, packet203tabcomplete.d()).iterator(); iterator.hasNext(); stringbuilder.append(s)) { - s = (String) iterator.next(); - if (stringbuilder.length() > 0) { - stringbuilder.append('\0'); // CraftBukkit - fix decompile issue - } - } - - this.player.playerConnection.sendPacket(new Packet203TabComplete(stringbuilder.toString())); - } - - public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) { - this.player.a(packet204localeandviewdistance); - } - - public void a(Packet250CustomPayload packet250custompayload) { - DataInputStream datainputstream; - ItemStack itemstack; - ItemStack itemstack1; - - // CraftBukkit start - Ignore empty payloads - if (packet250custompayload.length <= 0) { - return; - } - // CraftBukkit end - - if ("MC|BEdit".equals(packet250custompayload.tag)) { - try { - datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); - itemstack = Packet.c(datainputstream); - if (!ItemBookAndQuill.a(itemstack.getTag())) { - throw new IOException("Invalid book tag!"); - } - - itemstack1 = this.player.inventory.getItemInHand(); - if (itemstack != null && itemstack.id == Item.BOOK_AND_QUILL.id && itemstack.id == itemstack1.id) { - CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit - } - // CraftBukkit start - } catch (Throwable exception) { - this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BEdit data", exception); - this.disconnect("Invalid book data!"); - // CraftBukkit end - } - } else if ("MC|BSign".equals(packet250custompayload.tag)) { - try { - datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); - itemstack = Packet.c(datainputstream); - if (!ItemWrittenBook.a(itemstack.getTag())) { - throw new IOException("Invalid book tag!"); - } - - itemstack1 = this.player.inventory.getItemInHand(); - if (itemstack != null && itemstack.id == Item.WRITTEN_BOOK.id && itemstack1.id == Item.BOOK_AND_QUILL.id) { - CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit - } - // CraftBukkit start - } catch (Throwable exception1) { - this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BSign data", exception1); - this.disconnect("Invalid book data!"); - // CraftBukkit end - } - } else { - int i; - - if ("MC|TrSel".equals(packet250custompayload.tag)) { - try { - datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); - i = datainputstream.readInt(); - Container container = this.player.activeContainer; - - if (container instanceof ContainerMerchant) { - ((ContainerMerchant) container).e(i); - } - } catch (Exception exception2) { - // CraftBukkit start - this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|TrSel data", exception2); - this.disconnect("Invalid trade data!"); - // CraftBukkit end - } - } else { - int j; - - if ("MC|AdvCdm".equals(packet250custompayload.tag)) { - if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(ChatMessage.e("advMode.notEnabled")); - } else if (this.player.a(2, "") && this.player.abilities.canInstantlyBuild) { - try { - datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); - i = datainputstream.readInt(); - j = datainputstream.readInt(); - int k = datainputstream.readInt(); - String s = Packet.a((DataInput) datainputstream, 256); - TileEntity tileentity = this.player.world.getTileEntity(i, j, k); - - if (tileentity != null && tileentity instanceof TileEntityCommand) { - ((TileEntityCommand) tileentity).a(s); - this.player.world.notify(i, j, k); - this.player.sendMessage(ChatMessage.b("advMode.setCommand.success", new Object[] { s})); - } - } catch (Exception exception3) { - // CraftBukkit start - this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|AdvCdm data", exception3); - this.disconnect("Invalid CommandBlock data!"); - // CraftBukkit end - } - } else { - this.player.sendMessage(ChatMessage.e("advMode.notAllowed")); - } - } else if ("MC|Beacon".equals(packet250custompayload.tag)) { - if (this.player.activeContainer instanceof ContainerBeacon) { - try { - datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data)); - i = datainputstream.readInt(); - j = datainputstream.readInt(); - ContainerBeacon containerbeacon = (ContainerBeacon) this.player.activeContainer; - Slot slot = containerbeacon.getSlot(0); - - if (slot.e()) { - slot.a(1); - TileEntityBeacon tileentitybeacon = containerbeacon.e(); - - tileentitybeacon.d(i); - tileentitybeacon.e(j); - tileentitybeacon.update(); - } - } catch (Exception exception4) { - // CraftBukkit start - this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|Beacon data", exception4); - this.disconnect("Invalid beacon data!"); - // CraftBukkit end - } - } - } else if ("MC|ItemName".equals(packet250custompayload.tag) && this.player.activeContainer instanceof ContainerAnvil) { - ContainerAnvil containeranvil = (ContainerAnvil) this.player.activeContainer; - - if (packet250custompayload.data != null && packet250custompayload.data.length >= 1) { - String s1 = SharedConstants.a(new String(packet250custompayload.data)); - - if (s1.length() <= 30) { - containeranvil.a(s1); - } - } else { - containeranvil.a(""); - } - } - // CraftBukkit start - else if (packet250custompayload.tag.equals("REGISTER")) { - try { - String channels = new String(packet250custompayload.data, "UTF8"); - for (String channel : channels.split("\0")) { - getPlayer().addChannel(channel); - } - } catch (UnsupportedEncodingException ex) { - throw new AssertionError(ex); - } - } else if (packet250custompayload.tag.equals("UNREGISTER")) { - try { - String channels = new String(packet250custompayload.data, "UTF8"); - for (String channel : channels.split("\0")) { - getPlayer().removeChannel(channel); - } - } catch (UnsupportedEncodingException ex) { - throw new AssertionError(ex); - } - } else { - server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packet250custompayload.tag, packet250custompayload.data); - } - // CraftBukkit end - } - } - } - - public boolean c() { - return this.disconnected; - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Chunk.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/Chunk.java similarity index 59% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Chunk.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/Chunk.java index 992e8b5d6..69b503cb1 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Chunk.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/Chunk.java @@ -1,4 +1,4 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.ArrayList; import java.util.Arrays; @@ -7,76 +7,64 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Random; +import java.util.concurrent.Callable; -import net.minecraft.server.v1_6_R3.AxisAlignedBB; -import net.minecraft.server.v1_6_R3.BiomeBase; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.BlockContainer; -import net.minecraft.server.v1_6_R3.ChunkCoordIntPair; -import net.minecraft.server.v1_6_R3.ChunkPosition; -import net.minecraft.server.v1_6_R3.ChunkSection; -import net.minecraft.server.v1_6_R3.EmptyChunk; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EnumSkyBlock; -import net.minecraft.server.v1_6_R3.IChunkProvider; -import net.minecraft.server.v1_6_R3.IContainer; -import net.minecraft.server.v1_6_R3.IEntitySelector; -import net.minecraft.server.v1_6_R3.Material; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.TileEntity; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldChunkManager; +import net.minecraft.server.v1_7_R1.ChunkAddEntityEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; // CraftBukkit public class Chunk { + private static final Logger t = LogManager.getLogger(); public static boolean a; private ChunkSection[] sections; - private byte[] s; + private byte[] v; public int[] b; public boolean[] c; public boolean d; public World world; public int[] heightMap; - public final int x; - public final int z; - private boolean t; + public final int locX; + public final int locZ; + private boolean w; public Map tileEntities; public List[] entitySlices; public boolean done; - public boolean l; + public boolean lit; public boolean m; - public long n; - public boolean seenByPlayer; - public int p; - public long q; - private int u; + public boolean n; + public boolean o; + public long p; + public boolean q; + public int r; + public long s; + private int x; public Chunk(World world, int i, int j) { this.sections = new ChunkSection[16]; - this.s = new byte[256]; + this.v = new byte[256]; this.b = new int[256]; this.c = new boolean[256]; this.tileEntities = new HashMap(); - this.u = 4096; + this.x = 4096; this.entitySlices = new List[16]; this.world = world; - this.x = i; - this.z = j; + this.locX = i; + this.locZ = j; this.heightMap = new int[256]; for (int k = 0; k < this.entitySlices.length; ++k) { - this.entitySlices[k] = new org.bukkit.craftbukkit.v1_6_R3.util.UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList + this.entitySlices[k] = new org.bukkit.craftbukkit.v1_7_R1.util.UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList } Arrays.fill(this.b, -999); - Arrays.fill(this.s, (byte) -1); + Arrays.fill(this.v, (byte) -1); // CraftBukkit start if (!(this instanceof EmptyChunk)) { - this.bukkitChunk = new org.bukkit.craftbukkit.v1_6_R3.CraftChunk(this); + this.bukkitChunk = new org.bukkit.craftbukkit.v1_7_R1.CraftChunk(this); } } @@ -84,23 +72,50 @@ public class Chunk { public boolean mustSave; // CraftBukkit end - public Chunk(World world, byte[] abyte, int i, int j) { + public Chunk(World world, Block[] ablock, int i, int j) { this(world, i, j); - int k = abyte.length / 256; + int k = ablock.length / 256; + boolean flag = !world.worldProvider.g; for (int l = 0; l < 16; ++l) { for (int i1 = 0; i1 < 16; ++i1) { for (int j1 = 0; j1 < k; ++j1) { - byte b0 = abyte[l << 11 | i1 << 7 | j1]; + Block block = ablock[l << 11 | i1 << 7 | j1]; - if (b0 != 0) { + if (block != null && block.getMaterial() != Material.AIR) { int k1 = j1 >> 4; if (this.sections[k1] == null) { - this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.g); + this.sections[k1] = new ChunkSection(k1 << 4, flag); } - this.sections[k1].setTypeId(l, j1 & 15, i1, b0); + this.sections[k1].setTypeId(l, j1 & 15, i1, block); + } + } + } + } + } + + public Chunk(World world, Block[] ablock, byte[] abyte, int i, int j) { + this(world, i, j); + int k = ablock.length / 256; + boolean flag = !world.worldProvider.g; + + for (int l = 0; l < 16; ++l) { + for (int i1 = 0; i1 < 16; ++i1) { + for (int j1 = 0; j1 < k; ++j1) { + int k1 = l * k * 16 | i1 * k | j1; + Block block = ablock[k1]; + + if (block != null && block != Blocks.AIR) { + int l1 = j1 >> 4; + + if (this.sections[l1] == null) { + this.sections[l1] = new ChunkSection(l1 << 4, flag); + } + + this.sections[l1].setTypeId(l, j1 & 15, i1, block); + this.sections[l1].setData(l, j1 & 15, i1, abyte[k1]); } } } @@ -108,7 +123,7 @@ public class Chunk { } public boolean a(int i, int j) { - return i == this.x && j == this.z; + return i == this.locX && j == this.locZ; } public int b(int i, int j) { @@ -132,13 +147,10 @@ public class Chunk { public void initLighting() { int i = this.h(); - this.p = Integer.MAX_VALUE; + this.r = Integer.MAX_VALUE; - int j; - int k; - - for (j = 0; j < 16; ++j) { - k = 0; + for (int j = 0; j < 16; ++j) { + int k = 0; while (k < 16) { this.b[j + (k << 4)] = -999; @@ -152,8 +164,8 @@ public class Chunk { } this.heightMap[k << 4 | j] = l; - if (l < this.p) { - this.p = l; + if (l < this.r) { + this.r = l; } } @@ -162,13 +174,19 @@ public class Chunk { int i1 = i + 16 - 1; do { - l -= this.b(j, i1, k); + int j1 = this.b(j, i1, k); + + if (j1 == 0 && l != 15) { + j1 = 1; + } + + l -= j1; if (l > 0) { ChunkSection chunksection = this.sections[i1 >> 4]; if (chunksection != null) { chunksection.setSkyLight(j, i1 & 15, k, l); - this.world.p((this.x << 4) + j, i1, (this.z << 4) + k); + this.world.m((this.locX << 4) + j, i1, (this.locZ << 4) + k); } } @@ -182,30 +200,24 @@ public class Chunk { } } - this.l = true; - - for (j = 0; j < 16; ++j) { - for (k = 0; k < 16; ++k) { - this.e(j, k); - } - } + this.n = true; } private void e(int i, int j) { this.c[i + j * 16] = true; - this.t = true; + this.w = true; } - private void q() { + private void c(boolean flag) { this.world.methodProfiler.a("recheckGaps"); - if (this.world.areChunksLoaded(this.x * 16 + 8, 0, this.z * 16 + 8, 16)) { + if (this.world.areChunksLoaded(this.locX * 16 + 8, 0, this.locZ * 16 + 8, 16)) { for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { if (this.c[i + j * 16]) { this.c[i + j * 16] = false; int k = this.b(i, j); - int l = this.x * 16 + i; - int i1 = this.z * 16 + j; + int l = this.locX * 16 + i; + int i1 = this.locZ * 16 + j; int j1 = this.world.g(l - 1, i1); int k1 = this.world.g(l + 1, i1); int l1 = this.world.g(l, i1 - 1); @@ -228,11 +240,15 @@ public class Chunk { this.g(l + 1, i1, k); this.g(l, i1 - 1, k); this.g(l, i1 + 1, k); + if (flag) { + this.world.methodProfiler.b(); + return; + } } } } - this.t = false; + this.w = false; } this.world.methodProfiler.b(); @@ -242,19 +258,19 @@ public class Chunk { int l = this.world.getHighestBlockYAt(i, j); if (l > k) { - this.d(i, j, k, l + 1); + this.c(i, j, k, l + 1); } else if (l < k) { - this.d(i, j, l, k + 1); + this.c(i, j, l, k + 1); } } - private void d(int i, int j, int k, int l) { + private void c(int i, int j, int k, int l) { if (l > k && this.world.areChunksLoaded(i, 0, j, 16)) { for (int i1 = k; i1 < l; ++i1) { this.world.c(EnumSkyBlock.SKY, i, i1, j); } - this.l = true; + this.n = true; } } @@ -271,10 +287,10 @@ public class Chunk { } if (i1 != l) { - this.world.e(i + this.x * 16, k + this.z * 16, i1, l); + this.world.b(i + this.locX * 16, k + this.locZ * 16, i1, l); this.heightMap[k << 4 | i] = i1; - int j1 = this.x * 16 + i; - int k1 = this.z * 16 + k; + int j1 = this.locX * 16 + i; + int k1 = this.locZ * 16 + k; int l1; int i2; @@ -286,7 +302,7 @@ public class Chunk { chunksection = this.sections[l1 >> 4]; if (chunksection != null) { chunksection.setSkyLight(i, l1 & 15, k, 15); - this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); + this.world.m((this.locX << 4) + i, l1, (this.locZ << 4) + k); } } } else { @@ -294,7 +310,7 @@ public class Chunk { chunksection = this.sections[l1 >> 4]; if (chunksection != null) { chunksection.setSkyLight(i, l1 & 15, k, 0); - this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); + this.world.m((this.locX << 4) + i, l1, (this.locZ << 4) + k); } } } @@ -330,34 +346,46 @@ public class Chunk { j2 = l; } - if (l1 < this.p) { - this.p = l1; + if (l1 < this.r) { + this.r = l1; } if (!this.world.worldProvider.g) { - this.d(j1 - 1, k1, i2, j2); - this.d(j1 + 1, k1, i2, j2); - this.d(j1, k1 - 1, i2, j2); - this.d(j1, k1 + 1, i2, j2); - this.d(j1, k1, i2, j2); + this.c(j1 - 1, k1, i2, j2); + this.c(j1 + 1, k1, i2, j2); + this.c(j1, k1 - 1, i2, j2); + this.c(j1, k1 + 1, i2, j2); + this.c(j1, k1, i2, j2); } - this.l = true; + this.n = true; } } public int b(int i, int j, int k) { - return Block.lightBlock[this.getTypeId(i, j, k)]; + return this.getType(i, j, k).k(); } - public int getTypeId(int i, int j, int k) { - if (j >> 4 >= this.sections.length) { - return 0; - } else { + public Block getType(int i, int j, int k) { + Block block = Blocks.AIR; + + if (j >> 4 < this.sections.length) { ChunkSection chunksection = this.sections[j >> 4]; - return chunksection != null ? chunksection.getTypeId(i, j & 15, k) : 0; + if (chunksection != null) { + try { + block = chunksection.getTypeId(i, j & 15, k); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Getting block"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being got"); + + crashreportsystemdetails.a("Location", (Callable) (new CrashReportLocation(this, i, j, k))); + throw new ReportedException(crashreport); + } + } } + + return block; } public int getData(int i, int j, int k) { @@ -370,105 +398,119 @@ public class Chunk { } } - public boolean a(int i, int j, int k, int l, int i1) { - int j1 = k << 4 | i; + public boolean a(int i, int j, int k, Block block, int l) { + int i1 = k << 4 | i; - if (j >= this.b[j1] - 1) { - this.b[j1] = -999; + if (j >= this.b[i1] - 1) { + this.b[i1] = -999; } - int k1 = this.heightMap[j1]; - int l1 = this.getTypeId(i, j, k); - int i2 = this.getData(i, j, k); + int j1 = this.heightMap[i1]; + Block block1 = this.getType(i, j, k); + int k1 = this.getData(i, j, k); - if (l1 == l && i2 == i1) { + if (block1 == block && k1 == l) { return false; } else { ChunkSection chunksection = this.sections[j >> 4]; boolean flag = false; if (chunksection == null) { - if (l == 0) { + if (block == Blocks.AIR) { return false; } chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g); - flag = j >= k1; + flag = j >= j1; } - int j2 = this.x * 16 + i; - int k2 = this.z * 16 + k; + int l1 = this.locX * 16 + i; + int i2 = this.locZ * 16 + k; - if (l1 != 0 && !this.world.isStatic) { - Block.byId[l1].l(this.world, j2, j, k2, i2); + if (!this.world.isStatic) { + block1.f(this.world, l1, j, i2, k1); } - chunksection.setTypeId(i, j & 15, k, l); - if (l1 != 0) { - if (!this.world.isStatic) { - Block.byId[l1].remove(this.world, j2, j, k2, l1, i2); - } else if (Block.byId[l1] instanceof IContainer && l1 != l) { - this.world.s(j2, j, k2); - } + // CraftBukkit start - Delay removing containers until after they're cleaned up + if (!(block1 instanceof IContainer)) { + chunksection.setTypeId(i, j & 15, k, block); + } + // CraftBukkit end + + if (!this.world.isStatic) { + block1.remove(this.world, l1, j, i2, block1, k1); + } else if (block1 instanceof IContainer && block1 != block) { + this.world.p(l1, j, i2); } - if (chunksection.getTypeId(i, j & 15, k) != l) { + // CraftBukkit start - Remove containers now after cleanup + if (block1 instanceof IContainer) { + chunksection.setTypeId(i, j & 15, k, block); + } + // CraftBukkit end + + if (chunksection.getTypeId(i, j & 15, k) != block) { return false; } else { - chunksection.setData(i, j & 15, k, i1); + chunksection.setData(i, j & 15, k, l); if (flag) { this.initLighting(); } else { - if (Block.lightBlock[l & 4095] > 0) { - if (j >= k1) { + int j2 = block.k(); + int k2 = block1.k(); + + if (j2 > 0) { + if (j >= j1) { this.h(i, j + 1, k); } - } else if (j == k1 - 1) { + } else if (j == j1 - 1) { this.h(i, j, k); } - this.e(i, k); + if (j2 != k2 && (j2 < k2 || this.getBrightness(EnumSkyBlock.SKY, i, j, k) > 0 || this.getBrightness(EnumSkyBlock.BLOCK, i, j, k) > 0)) { + this.e(i, k); + } } TileEntity tileentity; - if (l != 0) { - // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer - if (!this.world.isStatic && (!this.world.callingPlaceEvent || (Block.byId[l] instanceof BlockContainer))) { - Block.byId[l].onPlace(this.world, j2, j, k2); - } - - if (Block.byId[l] instanceof IContainer) { - // CraftBukkit start - Don't create tile entity if placement failed - if (this.getTypeId(i, j, k) != l) { - return false; - } - // CraftBukkit end - - tileentity = this.e(i, j, k); - if (tileentity == null) { - tileentity = ((IContainer) Block.byId[l]).b(this.world); - this.world.setTileEntity(j2, j, k2, tileentity); - } - - if (tileentity != null) { - tileentity.i(); - } - } - } else if (l1 > 0 && Block.byId[l1] instanceof IContainer) { + if (block1 instanceof IContainer) { tileentity = this.e(i, j, k); if (tileentity != null) { - tileentity.i(); + tileentity.u(); } } - this.l = true; + // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer + if (!this.world.isStatic && (!this.world.callingPlaceEvent || (block instanceof BlockContainer))) { + block.onPlace(this.world, l1, j, i2); + } + + if (block instanceof IContainer) { + // CraftBukkit start - Don't create tile entity if placement failed + if (this.getType(i, j, k) != block) { + return false; + } + // CraftBukkit end + + tileentity = this.e(i, j, k); + if (tileentity == null) { + tileentity = ((IContainer) block).a(this.world, l); + this.world.setTileEntity(l1, j, i2, tileentity); + } + + if (tileentity != null) { + tileentity.u(); + } + } + + this.n = true; return true; } } } - public boolean b(int i, int j, int k, int l) { + public boolean a(int i, int j, int k, int l) { ChunkSection chunksection = this.sections[j >> 4]; if (chunksection == null) { @@ -479,16 +521,14 @@ public class Chunk { if (i1 == l) { return false; } else { - this.l = true; + this.n = true; chunksection.setData(i, j & 15, k, l); - int j1 = chunksection.getTypeId(i, j & 15, k); - - if (j1 > 0 && Block.byId[j1] instanceof IContainer) { + if (chunksection.getTypeId(i, j & 15, k) instanceof IContainer) { TileEntity tileentity = this.e(i, j, k); if (tileentity != null) { - tileentity.i(); - tileentity.p = l; + tileentity.u(); + tileentity.g = l; } } @@ -511,7 +551,7 @@ public class Chunk { this.initLighting(); } - this.l = true; + this.n = true; if (enumskyblock == EnumSkyBlock.SKY) { if (!this.world.worldProvider.g) { chunksection.setSkyLight(i, j & 15, k, l); @@ -521,7 +561,7 @@ public class Chunk { } } - public int c(int i, int j, int k, int l) { + public int b(int i, int j, int k, int l) { ChunkSection chunksection = this.sections[j >> 4]; if (chunksection == null) { @@ -545,15 +585,16 @@ public class Chunk { } public void a(Entity entity) { - this.m = true; + this.o = true; int i = MathHelper.floor(entity.locX / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D); - if (i != this.x || j != this.z) { + if (i != this.locX || j != this.locZ) { // CraftBukkit start Bukkit.getLogger().warning("Wrong location for " + entity + " in world '" + world.getWorld().getName() + "'!"); + // t.error("Wrong location! " + entity); // Thread.dumpStack(); - Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.x + "," + this.z); + Bukkit.getLogger().warning("Entity is at " + entity.locX + "," + entity.locZ + " (chunk " + i + "," + j + ") but was stored in chunk " + this.locX + "," + this.locZ); // CraftBukkit end } @@ -570,15 +611,15 @@ public class Chunk { k = this.entitySlices.length - 1; } - entity.ai = true; - entity.aj = this.x; - entity.ak = k; - entity.al = this.z; + entity.ah = true; + entity.ai = this.locX; + entity.aj = k; + entity.ak = this.locZ; this.entitySlices[k].add(entity); } public void b(Entity entity) { - this.a(entity, entity.ak); + this.a(entity, entity.aj); } public void a(Entity entity, int i) { @@ -602,18 +643,14 @@ public class Chunk { TileEntity tileentity = (TileEntity) this.tileEntities.get(chunkposition); if (tileentity == null) { - int l = this.getTypeId(i, j, k); + Block block = this.getType(i, j, k); - if (l <= 0 || !Block.byId[l].t()) { + if (!block.isTileEntity()) { return null; } - if (tileentity == null) { - tileentity = ((IContainer) Block.byId[l]).b(this.world); - this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity); - } - - tileentity = (TileEntity) this.tileEntities.get(chunkposition); + tileentity = ((IContainer) block).a(this.world, this.getData(i, j, k)); + this.world.setTileEntity(this.locX * 16 + i, j, this.locZ * 16 + k, tileentity); } if (tileentity != null && tileentity.r()) { @@ -625,9 +662,9 @@ public class Chunk { } public void a(TileEntity tileentity) { - int i = tileentity.x - this.x * 16; + int i = tileentity.x - this.locX * 16; int j = tileentity.y; - int k = tileentity.z - this.z * 16; + int k = tileentity.z - this.locZ * 16; this.a(i, j, k, tileentity); if (this.d) { @@ -638,22 +675,22 @@ public class Chunk { public void a(int i, int j, int k, TileEntity tileentity) { ChunkPosition chunkposition = new ChunkPosition(i, j, k); - tileentity.b(this.world); - tileentity.x = this.x * 16 + i; + tileentity.a(this.world); + tileentity.x = this.locX * 16 + i; tileentity.y = j; - tileentity.z = this.z * 16 + k; - if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof IContainer) { + tileentity.z = this.locZ * 16 + k; + if (this.getType(i, j, k) instanceof IContainer) { if (this.tileEntities.containsKey(chunkposition)) { - ((TileEntity) this.tileEntities.get(chunkposition)).w_(); + ((TileEntity) this.tileEntities.get(chunkposition)).s(); } - tileentity.s(); + tileentity.t(); this.tileEntities.put(chunkposition, tileentity); // CraftBukkit start } else { System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.x + "," + tileentity.y + "," + tileentity.z - + " (" + org.bukkit.Material.getMaterial(getTypeId(i, j, k)) + ") where there was no entity tile!"); - System.out.println("Chunk coordinates: " + (this.x * 16) + "," + (this.z * 16)); + + " (" + org.bukkit.Material.getMaterial(Block.b(getType(i, j, k))) + ") where there was no entity tile!"); + System.out.println("Chunk coordinates: " + (this.locX * 16) + "," + (this.locZ * 16)); new Exception().printStackTrace(); // CraftBukkit end } @@ -666,7 +703,7 @@ public class Chunk { TileEntity tileentity = (TileEntity) this.tileEntities.remove(chunkposition); if (tileentity != null) { - tileentity.w_(); + tileentity.s(); } } } @@ -681,7 +718,7 @@ public class Chunk { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); - entity.R(); + entity.X(); } this.world.a(this.entitySlices[i]); @@ -717,22 +754,15 @@ public class Chunk { } public void e() { - this.l = true; + this.n = true; } public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) { int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D); - if (i < 0) { - i = 0; - j = Math.max(i, j); - } - - if (j >= this.entitySlices.length) { - j = this.entitySlices.length - 1; - i = Math.min(i, j); - } + i = MathHelper.a(i, 0, this.entitySlices.length - 1); + j = MathHelper.a(j, 0, this.entitySlices.length - 1); for (int k = i; k <= j; ++k) { List list1 = this.entitySlices[k]; @@ -742,7 +772,7 @@ public class Chunk { if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) { list.add(entity1); - Entity[] aentity = entity1.ao(); + Entity[] aentity = entity1.at(); if (aentity != null) { for (int i1 = 0; i1 < aentity.length; ++i1) { @@ -761,17 +791,8 @@ public class Chunk { int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D); int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D); - if (i < 0) { - i = 0; - } else if (i >= this.entitySlices.length) { - i = this.entitySlices.length - 1; - } - - if (j >= this.entitySlices.length) { - j = this.entitySlices.length - 1; - } else if (j < 0) { - j = 0; - } + i = MathHelper.a(i, 0, this.entitySlices.length - 1); + j = MathHelper.a(j, 0, this.entitySlices.length - 1); for (int k = i; k <= j; ++k) { List list1 = this.entitySlices[k]; @@ -788,18 +809,18 @@ public class Chunk { public boolean a(boolean flag) { if (flag) { - if (this.m && this.world.getTime() != this.n || this.l) { + if (this.o && this.world.getTime() != this.p || this.n) { return true; } - } else if (this.m && this.world.getTime() >= this.n + 600L) { + } else if (this.o && this.world.getTime() >= this.p + 600L) { return true; } - return this.l; + return this.n; } public Random a(long i) { - return new Random(this.world.getSeed() + (long) (this.x * this.x * 4987142) + (long) (this.x * 5947611) + (long) (this.z * this.z) * 4392871L + (long) (this.z * 389711) ^ i); + return new Random(this.world.getSeed() + (long) (this.locX * this.locX * 4987142) + (long) (this.locX * 5947611) + (long) (this.locZ * this.locZ) * 4392871L + (long) (this.locZ * 389711) ^ i); } public boolean isEmpty() { @@ -834,8 +855,8 @@ public class Chunk { l = -1; while (i1 > 0 && l == -1) { - int j1 = this.getTypeId(i, i1, j); - Material material = j1 == 0 ? Material.AIR : Block.byId[j1].material; + Block block = this.getType(i, i1, j); + Material material = block.getMaterial(); if (!material.isSolid() && !material.isLiquid()) { --i1; @@ -850,14 +871,23 @@ public class Chunk { return l; } - public void k() { - if (this.t && !this.world.worldProvider.g) { - this.q(); + public void b(boolean flag) { + if (this.w && !this.world.worldProvider.g && !flag) { + this.c(this.world.isStatic); + } + + this.m = true; + if (!this.lit && this.done) { + this.p(); } } + public boolean k() { + return this.m && this.done && this.lit; + } + public ChunkCoordIntPair l() { - return new ChunkCoordIntPair(this.x, this.z); + return new ChunkCoordIntPair(this.locX, this.locZ); } public boolean c(int i, int j) { @@ -885,75 +915,160 @@ public class Chunk { } public BiomeBase a(int i, int j, WorldChunkManager worldchunkmanager) { - int k = this.s[j << 4 | i] & 255; + int k = this.v[j << 4 | i] & 255; if (k == 255) { - BiomeBase biomebase = worldchunkmanager.getBiome((this.x << 4) + i, (this.z << 4) + j); + BiomeBase biomebase = worldchunkmanager.getBiome((this.locX << 4) + i, (this.locZ << 4) + j); k = biomebase.id; - this.s[j << 4 | i] = (byte) (k & 255); + this.v[j << 4 | i] = (byte) (k & 255); } - return BiomeBase.biomes[k] == null ? BiomeBase.PLAINS : BiomeBase.biomes[k]; + return BiomeBase.getBiome(k) == null ? BiomeBase.PLAINS : BiomeBase.getBiome(k); } public byte[] m() { - return this.s; + return this.v; } public void a(byte[] abyte) { - this.s = abyte; + this.v = abyte; } public void n() { - this.u = 0; + this.x = 0; } public void o() { for (int i = 0; i < 8; ++i) { - if (this.u >= 4096) { + if (this.x >= 4096) { return; } - int j = this.u % 16; - int k = this.u / 16 % 16; - int l = this.u / 256; + int j = this.x % 16; + int k = this.x / 16 % 16; + int l = this.x / 256; - ++this.u; - int i1 = (this.x << 4) + k; - int j1 = (this.z << 4) + l; + ++this.x; + int i1 = (this.locX << 4) + k; + int j1 = (this.locZ << 4) + l; for (int k1 = 0; k1 < 16; ++k1) { int l1 = (j << 4) + k1; - if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l) == 0) { - if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) { - this.world.A(i1, l1 - 1, j1); + if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l).getMaterial() == Material.AIR) { + if (this.world.getType(i1, l1 - 1, j1).m() > 0) { + this.world.t(i1, l1 - 1, j1); } - if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) { - this.world.A(i1, l1 + 1, j1); + if (this.world.getType(i1, l1 + 1, j1).m() > 0) { + this.world.t(i1, l1 + 1, j1); } - if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) { - this.world.A(i1 - 1, l1, j1); + if (this.world.getType(i1 - 1, l1, j1).m() > 0) { + this.world.t(i1 - 1, l1, j1); } - if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) { - this.world.A(i1 + 1, l1, j1); + if (this.world.getType(i1 + 1, l1, j1).m() > 0) { + this.world.t(i1 + 1, l1, j1); } - if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) { - this.world.A(i1, l1, j1 - 1); + if (this.world.getType(i1, l1, j1 - 1).m() > 0) { + this.world.t(i1, l1, j1 - 1); } - if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) { - this.world.A(i1, l1, j1 + 1); + if (this.world.getType(i1, l1, j1 + 1).m() > 0) { + this.world.t(i1, l1, j1 + 1); } - this.world.A(i1, l1, j1); + this.world.t(i1, l1, j1); } } } } + + public void p() { + this.done = true; + this.lit = true; + if (!this.world.worldProvider.g) { + if (this.world.b(this.locX * 16 - 1, 0, this.locZ * 16 - 1, this.locX * 16 + 1, 63, this.locZ * 16 + 1)) { + for (int i = 0; i < 16; ++i) { + for (int j = 0; j < 16; ++j) { + if (!this.f(i, j)) { + this.lit = false; + break; + } + } + } + + if (this.lit) { + Chunk chunk = this.world.getChunkAtWorldCoords(this.locX * 16 - 1, this.locZ * 16); + + chunk.a(3); + chunk = this.world.getChunkAtWorldCoords(this.locX * 16 + 16, this.locZ * 16); + chunk.a(1); + chunk = this.world.getChunkAtWorldCoords(this.locX * 16, this.locZ * 16 - 1); + chunk.a(0); + chunk = this.world.getChunkAtWorldCoords(this.locX * 16, this.locZ * 16 + 16); + chunk.a(2); + } + } else { + this.lit = false; + } + } + } + + private void a(int i) { + if (this.done) { + int j; + + if (i == 3) { + for (j = 0; j < 16; ++j) { + this.f(15, j); + } + } else if (i == 1) { + for (j = 0; j < 16; ++j) { + this.f(0, j); + } + } else if (i == 0) { + for (j = 0; j < 16; ++j) { + this.f(j, 15); + } + } else if (i == 2) { + for (j = 0; j < 16; ++j) { + this.f(j, 0); + } + } + } + } + + private boolean f(int i, int j) { + int k = this.h(); + boolean flag = false; + boolean flag1 = false; + + int l; + + for (l = k + 16 - 1; l > 63 || l > 0 && !flag1; --l) { + int i1 = this.b(i, l, j); + + if (i1 == 255 && l < 63) { + flag1 = true; + } + + if (!flag && i1 > 0) { + flag = true; + } else if (flag && i1 == 0 && !this.world.t(this.locX * 16 + i, l, this.locZ * 16 + j)) { + return false; + } + } + + for (; l > 0; --l) { + if (this.getType(i, l, j).m() > 0) { + this.world.t(this.locX * 16 + i, l, this.locZ * 16 + j); + } + } + + return true; + } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkAddEntityEvent.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkAddEntityEvent.java similarity index 94% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkAddEntityEvent.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkAddEntityEvent.java index 634af5131..95c3943b0 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkAddEntityEvent.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkAddEntityEvent.java @@ -1,4 +1,4 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkPreLoadEvent.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkPreLoadEvent.java similarity index 96% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkPreLoadEvent.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkPreLoadEvent.java index b995419cd..8253e2750 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkPreLoadEvent.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkPreLoadEvent.java @@ -1,4 +1,4 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkProviderServer.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkProviderServer.java similarity index 69% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkProviderServer.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkProviderServer.java index c5505f290..f9d151ab5 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ChunkProviderServer.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ChunkProviderServer.java @@ -1,42 +1,38 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.Set; + +import net.minecraft.server.v1_7_R1.ChunkPreLoadEvent; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + + // CraftBukkit start import java.util.Random; -import net.minecraft.server.v1_6_R3.BlockSand; -import net.minecraft.server.v1_6_R3.Chunk; -import net.minecraft.server.v1_6_R3.ChunkCoordinates; -import net.minecraft.server.v1_6_R3.ChunkPosition; -import net.minecraft.server.v1_6_R3.ChunkRegionLoader; -import net.minecraft.server.v1_6_R3.CrashReport; -import net.minecraft.server.v1_6_R3.CrashReportSystemDetails; -import net.minecraft.server.v1_6_R3.EmptyChunk; -import net.minecraft.server.v1_6_R3.EnumCreatureType; -import net.minecraft.server.v1_6_R3.IChunkLoader; -import net.minecraft.server.v1_6_R3.IChunkProvider; -import net.minecraft.server.v1_6_R3.IProgressUpdate; -import net.minecraft.server.v1_6_R3.ReportedException; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldServer; - import org.bukkit.Server; -import org.bukkit.craftbukkit.v1_6_R3.chunkio.ChunkIOExecutor; -import org.bukkit.craftbukkit.v1_6_R3.util.LongHash; -import org.bukkit.craftbukkit.v1_6_R3.util.LongHashSet; -import org.bukkit.craftbukkit.v1_6_R3.util.LongObjectHashMap; +import org.bukkit.craftbukkit.v1_7_R1.chunkio.ChunkIOExecutor; +import org.bukkit.craftbukkit.v1_7_R1.util.LongHash; +import org.bukkit.craftbukkit.v1_7_R1.util.LongHashSet; +import org.bukkit.craftbukkit.v1_7_R1.util.LongObjectHashMap; import org.bukkit.event.world.ChunkUnloadEvent; // CraftBukkit end public class ChunkProviderServer implements IChunkProvider { - // CraftBukkit start - public LongHashSet unloadQueue = new LongHashSet(); + private static final Logger b = LogManager.getLogger(); + // CraftBukkit start - private -> public + public LongHashSet unloadQueue = new LongHashSet(); // LongHashSet public Chunk emptyChunk; - public IChunkProvider chunkProvider; // CraftBukkit - private IChunkLoader e; + public IChunkProvider chunkProvider; + private IChunkLoader f; public boolean forceChunkLoad = false; // true -> false public LongObjectHashMap chunks = new LongObjectHashMap(); public WorldServer world; @@ -45,7 +41,7 @@ public class ChunkProviderServer implements IChunkProvider { public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { this.emptyChunk = new EmptyChunk(worldserver, 0, 0); this.world = worldserver; - this.e = ichunkloader; + this.f = ichunkloader; this.chunkProvider = ichunkprovider; } @@ -88,11 +84,11 @@ public class ChunkProviderServer implements IChunkProvider { while (iterator.hasNext()) { Chunk chunk = (Chunk) iterator.next(); - this.queueUnload(chunk.x, chunk.z); + this.queueUnload(chunk.locX, chunk.locZ); } } - // CraftBukkit start - add async variant, provide compatibility + // CraftBukkit start - Add async variant, provide compatibility public Chunk getChunkAt(int i, int j) { return getChunkAt(i, j, null); } @@ -103,16 +99,34 @@ public class ChunkProviderServer implements IChunkProvider { boolean newChunk = false; ChunkRegionLoader loader = null; - if (this.e instanceof ChunkRegionLoader) { - loader = (ChunkRegionLoader) this.e; + if (this.f instanceof ChunkRegionLoader) { + loader = (ChunkRegionLoader) this.f; } - // If the chunk exists but isn't loaded do it async - if (chunk == null && runnable != null && loader != null && loader.chunkExists(this.world, i, j)) { - ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); - return null; + // We can only use the queue for already generated chunks + if (chunk == null && loader != null && loader.chunkExists(this.world, i, j)) { + if (runnable != null) { + ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); + return null; + } else { + chunk = ChunkIOExecutor.syncChunkLoad(this.world, loader, this, i, j); + } + } else if (chunk == null) { + chunk = this.originalGetChunkAt(i, j); } - // CraftBukkit end + + // If we didn't load the chunk async and have a callback run it now + if (runnable != null) { + runnable.run(); + } + + return chunk; + } + + public Chunk originalGetChunkAt(int i, int j) { + this.unloadQueue.remove(i, j); + Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j)); + boolean newChunk = false; Server server = this.world.getServer(); @@ -124,7 +138,7 @@ public class ChunkProviderServer implements IChunkProvider { if (event.isCancelled()) return null; } - + if (chunk == null) { chunk = this.loadChunk(i, j); if (chunk == null) { @@ -138,7 +152,7 @@ public class ChunkProviderServer implements IChunkProvider { CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated"); crashreportsystemdetails.a("Location", String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); - crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); + crashreportsystemdetails.a("Position hash", Long.valueOf(LongHash.toLong(i, j))); // CraftBukkit - Use LongHash crashreportsystemdetails.a("Generator", this.chunkProvider.getName()); throw new ReportedException(crashreport); } @@ -147,9 +161,7 @@ public class ChunkProviderServer implements IChunkProvider { } this.chunks.put(LongHash.toLong(i, j), chunk); // CraftBukkit - if (chunk != null) { - chunk.addEntities(); - } + chunk.addEntities(); // CraftBukkit start if (server != null) { @@ -161,16 +173,9 @@ public class ChunkProviderServer implements IChunkProvider { server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk)); } // CraftBukkit end - chunk.a(this, this, i, j); } - // CraftBukkit start - If we didn't need to load the chunk run the callback now - if (runnable != null) { - runnable.run(); - } - // CraftBukkit end - return chunk; } @@ -180,9 +185,9 @@ public class ChunkProviderServer implements IChunkProvider { chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk; if (chunk == this.emptyChunk) return chunk; - if (i != chunk.x || j != chunk.z) { - this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'"); - this.world.getLogger().severe(chunk.getClass().getName()); + if (i != chunk.locX || j != chunk.locZ) { + b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'"); + b.error(chunk.getClass().getName()); Throwable ex = new Throwable(); ex.fillInStackTrace(); ex.printStackTrace(); @@ -192,14 +197,14 @@ public class ChunkProviderServer implements IChunkProvider { } public Chunk loadChunk(int i, int j) { // CraftBukkit - private -> public - if (this.e == null) { + if (this.f == null) { return null; } else { try { - Chunk chunk = this.e.a(this.world, i, j); + Chunk chunk = this.f.a(this.world, i, j); if (chunk != null) { - chunk.n = this.world.getTime(); + chunk.p = this.world.getTime(); if (this.chunkProvider != null) { this.chunkProvider.recreateStructures(i, j); } @@ -207,35 +212,35 @@ public class ChunkProviderServer implements IChunkProvider { return chunk; } catch (Exception exception) { - exception.printStackTrace(); + b.error("Couldn\'t load chunk", exception); return null; } } } public void saveChunkNOP(Chunk chunk) { // CraftBukkit - private -> public - if (this.e != null) { + if (this.f != null) { try { - this.e.b(this.world, chunk); + this.f.b(this.world, chunk); } catch (Exception exception) { - exception.printStackTrace(); + b.error("Couldn\'t save entities", exception); } } } public void saveChunk(Chunk chunk) { // CraftBukkit - private -> public - if (this.e != null) { + if (this.f != null) { try { - chunk.n = this.world.getTime(); - this.e.a(this.world, chunk); - } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception - ioexception.printStackTrace(); - // CraftBukkit start - remove extra exception + chunk.p = this.world.getTime(); + this.f.a(this.world, chunk); + // CraftBukkit start - IOException to Exception + } catch (Exception ioexception) { + b.error("Couldn\'t save chunk", ioexception); + /* Remove extra exception + } catch (ExceptionWorldConflict exceptionworldconflict) { + b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict); + // CraftBukkit end */ } - // } catch (ExceptionWorldConflict exceptionworldconflict) { - // exceptionworldconflict.printStackTrace(); - // } - // CraftBukkit end } } @@ -243,7 +248,7 @@ public class ChunkProviderServer implements IChunkProvider { Chunk chunk = this.getOrCreateChunk(i, j); if (!chunk.done) { - chunk.done = true; + chunk.p(); if (this.chunkProvider != null) { this.chunkProvider.getChunkAt(ichunkprovider, i, j); @@ -257,8 +262,13 @@ public class ChunkProviderServer implements IChunkProvider { org.bukkit.World world = this.world.getWorld(); if (world != null) { - for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { - populator.populate(world, random, chunk.bukkitChunk); + this.world.populating = true; + try { + for (org.bukkit.generator.BlockPopulator populator : world.getPopulators()) { + populator.populate(world, random, chunk.bukkitChunk); + } + } finally { + this.world.populating = false; } } BlockSand.instaFall = false; @@ -285,7 +295,7 @@ public class ChunkProviderServer implements IChunkProvider { if (chunk.a(flag)) { this.saveChunk(chunk); - chunk.l = false; + chunk.n = false; ++i; if (i == 24 && !flag) { return false; @@ -297,11 +307,11 @@ public class ChunkProviderServer implements IChunkProvider { } public void b() { - if (this.e != null) { - this.e.b(); + if (this.f != null) { + this.f.b(); } } - + public boolean unloadChunks() { if (!this.world.savingDisabled) { // CraftBukkit start @@ -317,14 +327,15 @@ public class ChunkProviderServer implements IChunkProvider { chunk.removeEntities(); this.saveChunk(chunk); this.saveChunkNOP(chunk); - // this.unloadQueue.remove(integer); + // this.unloadQueue.remove(olong); + // this.chunks.remove(olong.longValue()); this.chunks.remove(chunkcoordinates); // CraftBukkit } } // CraftBukkit end - if (this.e != null) { - this.e.a(); + if (this.f != null) { + this.f.a(); } } @@ -336,7 +347,8 @@ public class ChunkProviderServer implements IChunkProvider { } public String getName() { - return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); // CraftBukkit + // CraftBukkit - this.chunks.count() -> .values().size() + return "ServerChunkCache: " + this.chunks.values().size() + " Drop: " + this.unloadQueue.size(); } public List getMobsFor(EnumCreatureType enumcreaturetype, int i, int j, int k) { @@ -348,7 +360,8 @@ public class ChunkProviderServer implements IChunkProvider { } public int getLoadedChunks() { - return this.chunks.values().size(); // CraftBukkit + // CraftBukkit - this.chunks.count() -> .values().size() + return this.chunks.values().size(); } public void recreateStructures(int i, int j) {} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ContainerAnvilInventory.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ContainerAnvilInventory.java similarity index 80% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ContainerAnvilInventory.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ContainerAnvilInventory.java index 11fed5ab3..ca2c6c2ca 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/ContainerAnvilInventory.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/ContainerAnvilInventory.java @@ -1,14 +1,8 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; // CraftBukkit start import java.util.List; - -import net.minecraft.server.v1_6_R3.ContainerAnvil; -import net.minecraft.server.v1_6_R3.IInventory; -import net.minecraft.server.v1_6_R3.InventorySubcontainer; -import net.minecraft.server.v1_6_R3.ItemStack; - -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftHumanEntity; import org.bukkit.entity.HumanEntity; // CraftBukkit end diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Entity.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/Entity.java similarity index 82% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Entity.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/Entity.java index aec526eda..f0012f96e 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/Entity.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/Entity.java @@ -1,48 +1,10 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.List; import java.util.Random; import java.util.UUID; import java.util.concurrent.Callable; -import net.minecraft.server.v1_6_R3.AxisAlignedBB; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.BlockFluids; -import net.minecraft.server.v1_6_R3.CrashReport; -import net.minecraft.server.v1_6_R3.CrashReportEntityName; -import net.minecraft.server.v1_6_R3.CrashReportEntityType; -import net.minecraft.server.v1_6_R3.CrashReportSystemDetails; -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.Direction; -import net.minecraft.server.v1_6_R3.EnchantmentProtection; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.EntityItem; -import net.minecraft.server.v1_6_R3.EntityLightning; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EntityTameableAnimal; -import net.minecraft.server.v1_6_R3.EntityTypes; -import net.minecraft.server.v1_6_R3.EnumEntitySize; -import net.minecraft.server.v1_6_R3.Explosion; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.LocaleI18n; -import net.minecraft.server.v1_6_R3.Material; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.NBTTagDouble; -import net.minecraft.server.v1_6_R3.NBTTagFloat; -import net.minecraft.server.v1_6_R3.NBTTagList; -import net.minecraft.server.v1_6_R3.ReportedException; -import net.minecraft.server.v1_6_R3.StepSound; -import net.minecraft.server.v1_6_R3.Vec3D; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldServer; - - // CraftBukkit start import org.bukkit.Bukkit; import org.bukkit.Location; @@ -57,9 +19,9 @@ import org.bukkit.event.painting.PaintingBreakByEntityEvent; import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; import org.bukkit.event.vehicle.VehicleEnterEvent; import org.bukkit.event.vehicle.VehicleExitEvent; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageEvent; @@ -77,12 +39,12 @@ public abstract class Entity { // CraftBukkit end private static int entityCount; - public int id; - public double l; - public boolean m; + private int id; + public double k; + public boolean l; public Entity passenger; public Entity vehicle; - public boolean p; + public boolean o; public World world; public double lastX; public double lastY; @@ -100,27 +62,27 @@ public abstract class Entity { public final AxisAlignedBB boundingBox; public boolean onGround; public boolean positionChanged; + public boolean G; public boolean H; - public boolean I; public boolean velocityChanged; - protected boolean K; - public boolean L; + protected boolean J; + public boolean K; public boolean dead; public float height; public float width; public float length; + public float P; public float Q; public float R; - public float S; public float fallDistance; - private int c; + private int d; + public double T; public double U; public double V; - public double W; + public float W; public float X; - public float Y; - public boolean Z; - public float aa; + public boolean Y; + public float Z; protected Random random; public int ticksLived; public int maxFireTicks; @@ -130,39 +92,47 @@ public abstract class Entity { private boolean justCreated; protected boolean fireProof; protected DataWatcher datawatcher; - private double f; private double g; - public boolean ai; + private double h; + public boolean ah; + public int ai; public int aj; public int ak; - public int al; + public boolean al; public boolean am; - public boolean an; public int portalCooldown; - protected boolean ap; - protected int aq; + protected boolean ao; + protected int ap; public int dimension; - protected int as; + protected int ar; private boolean invulnerable; - public UUID uniqueID; // CraftBukkit - private -> public + public UUID uniqueID; // CraftBukkit - protected -> public public EnumEntitySize at; public boolean valid; // CraftBukkit + public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public boolean Invisible; public boolean Silent; + public int getId() { + return this.id; + } + + public void d(int i) { + this.id = i; + } + public Entity(World world) { this.id = entityCount++; - this.l = 1.0D; + this.k = 1.0D; this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); - this.L = true; + this.K = true; this.width = 0.6F; this.length = 1.8F; - this.c = 1; + this.d = 1; this.random = new Random(); this.maxFireTicks = 1; this.justCreated = true; - this.datawatcher = new DataWatcher(); this.uniqueID = UUID.randomUUID(); this.at = EnumEntitySize.SIZE_2; this.world = world; @@ -171,12 +141,13 @@ public abstract class Entity { this.dimension = world.worldProvider.dimension; } + this.datawatcher = new DataWatcher(this); this.datawatcher.a(0, Byte.valueOf((byte) 0)); this.datawatcher.a(1, Short.valueOf((short) 300)); - this.a(); + this.c(); } - protected abstract void a(); + protected abstract void c(); public DataWatcher getDataWatcher() { return this.datawatcher; @@ -264,20 +235,20 @@ public abstract class Entity { float f = this.width / 2.0F; float f1 = this.length; - this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.X, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.X + (double) f1, d2 + (double) f); + this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.W, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.W + (double) f1, d2 + (double) f); } - public void l_() { - this.y(); + public void h() { + this.C(); } - public void y() { + public void C() { this.world.methodProfiler.a("entityBaseTick"); if (this.vehicle != null && this.vehicle.dead) { this.vehicle = null; } - this.Q = this.R; + this.P = this.Q; this.lastX = this.locX; this.lastY = this.locY; this.lastZ = this.locZ; @@ -289,12 +260,12 @@ public abstract class Entity { this.world.methodProfiler.a("portal"); MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer(); - i = this.z(); - if (this.ap) { + i = this.D(); + if (this.ao) { if (true || minecraftserver.getAllowNether()) { // CraftBukkit - if (this.vehicle == null && this.aq++ >= i) { - this.aq = i; - this.portalCooldown = this.ac(); + if (this.vehicle == null && this.ap++ >= i) { + this.ap = i; + this.portalCooldown = this.ai(); byte b0; if (this.world.worldProvider.dimension == -1) { @@ -306,15 +277,15 @@ public abstract class Entity { this.b(b0); } - this.ap = false; + this.ao = false; } } else { - if (this.aq > 0) { - this.aq -= 4; + if (this.ap > 0) { + this.ap -= 4; } - if (this.aq < 0) { - this.aq = 0; + if (this.ap < 0) { + this.ap = 0; } } @@ -325,19 +296,19 @@ public abstract class Entity { this.world.methodProfiler.b(); } - if (this.isSprinting() && !this.H()) { + if (this.isSprinting() && !this.M()) { int j = MathHelper.floor(this.locX); i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int k = MathHelper.floor(this.locZ); - int l = this.world.getTypeId(j, i, k); + Block block = this.world.getType(j, i, k); - if (l > 0) { - this.world.addParticle("tilecrack_" + l + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); + if (block.getMaterial() != Material.AIR) { + this.world.addParticle("blockcrack_" + Block.b(block) + "_" + this.world.getData(j, i, k), this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); } } - this.I(); + this.N(); if (this.world.isStatic) { this.fireTicks = 0; } else if (this.fireTicks > 0) { @@ -355,13 +326,13 @@ public abstract class Entity { } } - if (this.J()) { - this.A(); + if (this.P()) { + this.E(); this.fallDistance *= 0.5F; } if (this.locY < -64.0D) { - this.C(); + this.G(); } if (!this.world.isStatic) { @@ -372,11 +343,11 @@ public abstract class Entity { this.world.methodProfiler.b(); } - public int z() { + public int D() { return 0; } - protected void A() { + protected void E() { if (!this.fireProof) { // CraftBukkit start - Fallen in lava TODO: this event spams! if (this instanceof EntityLiving) { @@ -428,7 +399,7 @@ public abstract class Entity { this.fireTicks = 0; } - protected void C() { + protected void G() { this.die(); } @@ -441,25 +412,35 @@ public abstract class Entity { public void move(double d0, double d1, double d2) { // CraftBukkit start - Don't do anything if we aren't moving + // We need to do this regardless of whether or not we are moving thanks to portals + try { + this.I(); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision"); + + this.a(crashreportsystemdetails); + throw new ReportedException(crashreport); + } + // Check if we're moving if (d0 == 0 && d1 == 0 && d2 == 0 && this.vehicle == null && this.passenger == null) { return; } // CraftBukkit end - - if (this.Z) { + if (this.Y) { this.boundingBox.d(d0, d1, d2); this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; - this.locY = this.boundingBox.b + (double) this.height - (double) this.X; + this.locY = this.boundingBox.b + (double) this.height - (double) this.W; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; } else { this.world.methodProfiler.a("move"); - this.X *= 0.4F; + this.W *= 0.4F; double d3 = this.locX; double d4 = this.locY; double d5 = this.locZ; - if (this.K) { - this.K = false; + if (this.J) { + this.J = false; d0 *= 0.25D; d1 *= 0.05000000074505806D; d2 *= 0.25D; @@ -526,7 +507,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.L && d7 != d1) { + if (!this.K && d7 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -541,7 +522,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.L && d6 != d0) { + if (!this.K && d6 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -552,7 +533,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.L && d8 != d2) { + if (!this.K && d8 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -563,12 +544,12 @@ public abstract class Entity { double d12; int k; - if (this.Y > 0.0F && flag1 && (flag || this.X < 0.05F) && (d6 != d0 || d8 != d2)) { + if (this.X > 0.0F && flag1 && (flag || this.W < 0.05F) && (d6 != d0 || d8 != d2)) { d10 = d0; d11 = d1; d12 = d2; d0 = d6; - d1 = (double) this.Y; + d1 = (double) this.X; d2 = d8; AxisAlignedBB axisalignedbb1 = this.boundingBox.clone(); @@ -580,7 +561,7 @@ public abstract class Entity { } this.boundingBox.d(0.0D, d1, 0.0D); - if (!this.L && d7 != d1) { + if (!this.K && d7 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -591,7 +572,7 @@ public abstract class Entity { } this.boundingBox.d(d0, 0.0D, 0.0D); - if (!this.L && d6 != d0) { + if (!this.K && d6 != d0) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; @@ -602,18 +583,18 @@ public abstract class Entity { } this.boundingBox.d(0.0D, 0.0D, d2); - if (!this.L && d8 != d2) { + if (!this.K && d8 != d2) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } - if (!this.L && d7 != d1) { + if (!this.K && d7 != d1) { d2 = 0.0D; d1 = 0.0D; d0 = 0.0D; } else { - d1 = (double) (-this.Y); + d1 = (double) (-this.X); for (k = 0; k < list.size(); ++k) { d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1); @@ -633,12 +614,12 @@ public abstract class Entity { this.world.methodProfiler.b(); this.world.methodProfiler.a("rest"); this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D; - this.locY = this.boundingBox.b + (double) this.height - (double) this.X; + this.locY = this.boundingBox.b + (double) this.height - (double) this.W; this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D; this.positionChanged = d6 != d0 || d8 != d2; - this.H = d7 != d1; + this.G = d7 != d1; this.onGround = d7 != d1 && d7 < 0.0D; - this.I = this.positionChanged || this.H; + this.H = this.positionChanged || this.G; this.a(d1, this.onGround); if (d6 != d0) { this.motX = 0.0D; @@ -676,57 +657,57 @@ public abstract class Entity { } // CraftBukkit end - if (this.e_() && !flag && this.vehicle == null) { + if (this.g_() && !flag && this.vehicle == null) { int l = MathHelper.floor(this.locX); k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int i1 = MathHelper.floor(this.locZ); - int j1 = this.world.getTypeId(l, k, i1); + Block block = this.world.getType(l, k, i1); + int j1 = this.world.getType(l, k - 1, i1).b(); - if (j1 == 0) { - int k1 = this.world.e(l, k - 1, i1); - - if (k1 == 11 || k1 == 32 || k1 == 21) { - j1 = this.world.getTypeId(l, k - 1, i1); - } + if (j1 == 11 || j1 == 32 || j1 == 21) { + block = this.world.getType(l, k - 1, i1); } - if (j1 != Block.LADDER.id) { + if (block != Blocks.LADDER) { d11 = 0.0D; } - this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D); - this.S = (float) ((double) this.S + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D); - if (this.S > (float) this.c && j1 > 0) { - this.c = (int) this.S + 1; - if (this.H()) { + this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D); + this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D); + if (this.R > (float) this.d && block.getMaterial() != Material.AIR) { + this.d = (int) this.R + 1; + if (this.M()) { float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F; if (f > 1.0F) { f = 1.0F; } - this.makeSound("liquid.swim", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + this.makeSound(this.H(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); } if (!Silent) - a(l, k, i1, j1); + a(l, k, i1, block); - Block.byId[j1].b(this.world, l, k, i1, this); + block.b(this.world, l, k, i1, this); } } + // CraftBukkit start - Move to the top of the method + /* try { - this.D(); + this.I(); } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Checking entity tile collision"); + CrashReport crashreport = CrashReport.a(throwable, "Checking entity block collision"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision"); this.a(crashreportsystemdetails); throw new ReportedException(crashreport); } - - boolean flag2 = this.G(); + */ + // CraftBukkit end + boolean flag2 = this.L(); if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) { this.burn(1); @@ -758,7 +739,11 @@ public abstract class Entity { } } - protected void D() { + protected String H() { + return "game.neutral.swim"; + } + + protected void I() { int i = MathHelper.floor(this.boundingBox.a + 0.001D); int j = MathHelper.floor(this.boundingBox.b + 0.001D); int k = MathHelper.floor(this.boundingBox.c + 0.001D); @@ -766,22 +751,20 @@ public abstract class Entity { int i1 = MathHelper.floor(this.boundingBox.e - 0.001D); int j1 = MathHelper.floor(this.boundingBox.f - 0.001D); - if (this.world.e(i, j, k, l, i1, j1)) { + if (this.world.b(i, j, k, l, i1, j1)) { for (int k1 = i; k1 <= l; ++k1) { for (int l1 = j; l1 <= i1; ++l1) { for (int i2 = k; i2 <= j1; ++i2) { - int j2 = this.world.getTypeId(k1, l1, i2); + Block block = this.world.getType(k1, l1, i2); - if (j2 > 0) { - try { - Block.byId[j2].a(this.world, k1, l1, i2, this); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Colliding entity with tile"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Tile being collided with"); + try { + block.a(this.world, k1, l1, i2, this); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Colliding entity with block"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being collided with"); - CrashReportSystemDetails.a(crashreportsystemdetails, k1, l1, i2, j2, this.world.getData(k1, l1, i2)); - throw new ReportedException(crashreport); - } + CrashReportSystemDetails.a(crashreportsystemdetails, k1, l1, i2, block, this.world.getData(k1, l1, i2)); + throw new ReportedException(crashreport); } } } @@ -789,13 +772,13 @@ public abstract class Entity { } } - protected void a(int i, int j, int k, int l) { - StepSound stepsound = Block.byId[l].stepSound; + protected void a(int i, int j, int k, Block block) { + StepSound stepsound = block.stepSound; - if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) { - stepsound = Block.SNOW.stepSound; + if (this.world.getType(i, j + 1, k) == Blocks.SNOW) { + stepsound = Blocks.SNOW.stepSound; this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); - } else if (!Block.byId[l].material.isLiquid()) { + } else if (!block.getMaterial().isLiquid()) { this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } } @@ -804,7 +787,7 @@ public abstract class Entity { this.world.makeSound(this, s, f, f1); } - protected boolean e_() { + protected boolean g_() { return true; } @@ -819,7 +802,7 @@ public abstract class Entity { } } - public AxisAlignedBB E() { + public AxisAlignedBB J() { return null; } @@ -839,15 +822,15 @@ public abstract class Entity { } } - public boolean G() { + public boolean L() { return this.inWater || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.isRainingAt(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ)); } - public boolean H() { + public boolean M() { return this.inWater; } - public boolean I() { + public boolean N() { if (this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this)) { if (!this.inWater && !this.justCreated) { float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F; @@ -856,7 +839,7 @@ public abstract class Entity { f = 1.0F; } - this.makeSound("liquid.splash", f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); + this.makeSound(this.O(), f, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F); float f1 = (float) MathHelper.floor(this.boundingBox.b); int i; @@ -886,15 +869,19 @@ public abstract class Entity { return this.inWater; } + protected String O() { + return "game.neutral.swim.splash"; + } + public boolean a(Material material) { double d0 = this.locY + (double) this.getHeadHeight(); int i = MathHelper.floor(this.locX); int j = MathHelper.d((float) MathHelper.floor(d0)); int k = MathHelper.floor(this.locZ); - int l = this.world.getTypeId(i, j, k); + Block block = this.world.getType(i, j, k); - if (l != 0 && Block.byId[l].material == material) { - float f = BlockFluids.d(this.world.getData(i, j, k)) - 0.11111111F; + if (block.getMaterial() == material) { + float f = BlockFluids.b(this.world.getData(i, j, k)) - 0.11111111F; float f1 = (float) (j + 1) - f; return d0 < (double) f1; @@ -907,7 +894,7 @@ public abstract class Entity { return 0.0F; } - public boolean J() { + public boolean P() { return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA); } @@ -939,7 +926,7 @@ public abstract class Entity { double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D; int k = MathHelper.floor(this.locY - (double) this.height + d0); - return this.world.q(i, k, j); + return this.world.n(i, k, j); } else { return 0.0F; } @@ -963,7 +950,7 @@ public abstract class Entity { this.lastZ = this.locZ = d2; this.lastYaw = this.yaw = f; this.lastPitch = this.pitch = f1; - this.X = 0.0F; + this.W = 0.0F; double d3 = (double) (this.lastYaw - f); if (d3 < -180.0D) { @@ -979,9 +966,9 @@ public abstract class Entity { } public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { - this.U = this.lastX = this.locX = d0; - this.V = this.lastY = this.locY = d1 + (double) this.height; - this.W = this.lastZ = this.locZ = d2; + this.T = this.lastX = this.locX = d0; + this.U = this.lastY = this.locY = d1 + (double) this.height; + this.V = this.lastZ = this.locZ = d2; this.yaw = f; this.pitch = f1; this.setPosition(this.locX, this.locY, this.locZ); @@ -1041,8 +1028,8 @@ public abstract class Entity { d1 *= d3; d0 *= 0.05000000074505806D; d1 *= 0.05000000074505806D; - d0 *= (double) (1.0F - this.aa); - d1 *= (double) (1.0F - this.aa); + d0 *= (double) (1.0F - this.Z); + d1 *= (double) (1.0F - this.Z); this.g(-d0, 0.0D, -d1); entity.g(d0, 0.0D, d1); } @@ -1053,10 +1040,10 @@ public abstract class Entity { this.motX += d0; this.motY += d1; this.motZ += d2; - this.an = true; + this.am = true; } - protected void K() { + protected void Q() { this.velocityChanged = true; } @@ -1064,23 +1051,23 @@ public abstract class Entity { if (this.isInvulnerable()) { return false; } else { - this.K(); + this.Q(); return false; } } - public boolean L() { + public boolean R() { return false; } - public boolean M() { + public boolean S() { return false; } public void b(Entity entity, int i) {} public boolean c(NBTTagCompound nbttagcompound) { - String s = this.Q(); + String s = this.W(); if (!this.dead && s != null) { nbttagcompound.setString("id", s); @@ -1092,7 +1079,7 @@ public abstract class Entity { } public boolean d(NBTTagCompound nbttagcompound) { - String s = this.Q(); + String s = this.W(); if (!this.dead && s != null && this.passenger == null) { nbttagcompound.setString("id", s); @@ -1105,7 +1092,7 @@ public abstract class Entity { public void e(NBTTagCompound nbttagcompound) { try { - nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.X, this.locZ})); + nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.W, this.locZ})); nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero @@ -1127,8 +1114,8 @@ public abstract class Entity { nbttagcompound.setInt("Dimension", this.dimension); nbttagcompound.setBoolean("Invulnerable", this.invulnerable); nbttagcompound.setInt("PortalCooldown", this.portalCooldown); - nbttagcompound.setLong("UUIDMost", this.uniqueID.getMostSignificantBits()); - nbttagcompound.setLong("UUIDLeast", this.uniqueID.getLeastSignificantBits()); + nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits()); + nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits()); // CraftBukkit start nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits()); @@ -1136,7 +1123,7 @@ public abstract class Entity { // CraftBukkit end this.b(nbttagcompound); if (this.vehicle != null) { - NBTTagCompound nbttagcompound1 = new NBTTagCompound("Riding"); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); if (this.vehicle.c(nbttagcompound1)) { nbttagcompound.set("Riding", nbttagcompound1); @@ -1153,13 +1140,13 @@ public abstract class Entity { public void f(NBTTagCompound nbttagcompound) { try { - NBTTagList nbttaglist = nbttagcompound.getList("Pos"); - NBTTagList nbttaglist1 = nbttagcompound.getList("Motion"); - NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation"); + NBTTagList nbttaglist = nbttagcompound.getList("Pos", 6); + NBTTagList nbttaglist1 = nbttagcompound.getList("Motion", 6); + NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation", 5); - this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data; - this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data; - this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data; + this.motX = nbttaglist1.d(0); + this.motY = nbttaglist1.d(1); + this.motZ = nbttaglist1.d(2); /* CraftBukkit start - Moved section down if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; @@ -1174,11 +1161,11 @@ public abstract class Entity { } // CraftBukkit end */ - this.lastX = this.U = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data; - this.lastY = this.V = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data; - this.lastZ = this.W = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data; - this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data; - this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data; + this.lastX = this.T = this.locX = nbttaglist.d(0); + this.lastY = this.U = this.locY = nbttaglist.d(1); + this.lastZ = this.V = this.locZ = nbttaglist.d(2); + this.lastYaw = this.yaw = nbttaglist2.e(0); + this.lastPitch = this.pitch = nbttaglist2.e(1); this.fallDistance = nbttagcompound.getFloat("FallDistance"); this.fireTicks = nbttagcompound.getShort("Fire"); this.setAirTicks(nbttagcompound.getShort("Air")); @@ -1186,14 +1173,14 @@ public abstract class Entity { this.dimension = nbttagcompound.getInt("Dimension"); this.invulnerable = nbttagcompound.getBoolean("Invulnerable"); this.portalCooldown = nbttagcompound.getInt("PortalCooldown"); - if (nbttagcompound.hasKey("UUIDMost") && nbttagcompound.hasKey("UUIDLeast")) { + if (nbttagcompound.hasKeyOfType("UUIDMost", 4) && nbttagcompound.hasKeyOfType("UUIDLeast", 4)) { this.uniqueID = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast")); } this.setPosition(this.locX, this.locY, this.locZ); this.b(this.yaw, this.pitch); this.a(nbttagcompound); - if (this.P()) { + if (this.V()) { this.setPosition(this.locX, this.locY, this.locZ); } @@ -1242,7 +1229,7 @@ public abstract class Entity { if (bworld == null) { EntityPlayer entityPlayer = (EntityPlayer) this; - bworld = ((org.bukkit.craftbukkit.v1_6_R3.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld(); + bworld = ((org.bukkit.craftbukkit.v1_7_R1.CraftServer) server).getServer().getWorldServer(entityPlayer.dimension).getWorld(); } this.spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle()); @@ -1257,11 +1244,11 @@ public abstract class Entity { } } - protected boolean P() { + protected boolean V() { return true; } - protected final String Q() { + protected final String W() { return EntityTypes.b(this); } @@ -1269,7 +1256,7 @@ public abstract class Entity { protected abstract void b(NBTTagCompound nbttagcompound); - public void R() {} + public void X() {} protected NBTTagList a(double... adouble) { NBTTagList nbttaglist = new NBTTagList(); @@ -1279,7 +1266,7 @@ public abstract class Entity { for (int j = 0; j < i; ++j) { double d0 = adouble1[j]; - nbttaglist.add(new NBTTagDouble((String) null, d0)); + nbttaglist.add(new NBTTagDouble(d0)); } return nbttaglist; @@ -1293,29 +1280,29 @@ public abstract class Entity { for (int j = 0; j < i; ++j) { float f = afloat1[j]; - nbttaglist.add(new NBTTagFloat((String) null, f)); + nbttaglist.add(new NBTTagFloat(f)); } return nbttaglist; } - public EntityItem b(int i, int j) { - return this.a(i, j, 0.0F); + public EntityItem a(Item item, int i) { + return this.a(item, i, 0.0F); } - public EntityItem a(int i, int j, float f) { - return this.a(new ItemStack(i, j, 0), f); + public EntityItem a(Item item, int i, float f) { + return this.a(new ItemStack(item, i, 0), f); } public EntityItem a(ItemStack itemstack, float f) { - if (itemstack.count == 0) { - return null; - } else { + if (itemstack.count != 0 && itemstack.getItem() != null) { EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack); entityitem.pickupDelay = 10; this.world.addEntity(entityitem); return entityitem; + } else { + return null; } } @@ -1332,7 +1319,7 @@ public abstract class Entity { int k = MathHelper.floor(this.locY + (double) this.getHeadHeight() + (double) f1); int l = MathHelper.floor(this.locZ + (double) f2); - if (this.world.u(j, k, l)) { + if (this.world.getType(j, k, l).r()) { return true; } } @@ -1348,36 +1335,36 @@ public abstract class Entity { return null; } - public void V() { + public void ab() { if (this.vehicle.dead) { this.vehicle = null; } else { this.motX = 0.0D; this.motY = 0.0D; this.motZ = 0.0D; - this.l_(); + this.h(); if (this.vehicle != null) { - this.vehicle.W(); - this.g += (double) (this.vehicle.yaw - this.vehicle.lastYaw); + this.vehicle.ac(); + this.h += (double) (this.vehicle.yaw - this.vehicle.lastYaw); - for (this.f += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.g >= 180.0D; this.g -= 360.0D) { + for (this.g += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.h >= 180.0D; this.h -= 360.0D) { ; } + while (this.h < -180.0D) { + this.h += 360.0D; + } + + while (this.g >= 180.0D) { + this.g -= 360.0D; + } + while (this.g < -180.0D) { this.g += 360.0D; } - while (this.f >= 180.0D) { - this.f -= 360.0D; - } - - while (this.f < -180.0D) { - this.f += 360.0D; - } - - double d0 = this.g * 0.5D; - double d1 = this.f * 0.5D; + double d0 = this.h * 0.5D; + double d1 = this.g * 0.5D; float f = 10.0F; if (d0 > (double) f) { @@ -1396,23 +1383,23 @@ public abstract class Entity { d1 = (double) (-f); } - this.g -= d0; - this.f -= d1; + this.h -= d0; + this.g -= d1; } } } - public void W() { + public void ac() { if (this.passenger != null) { - this.passenger.setPosition(this.locX, this.locY + this.Y() + this.passenger.X(), this.locZ); + this.passenger.setPosition(this.locX, this.locY + this.ae() + this.passenger.ad(), this.locZ); } } - public double X() { + public double ad() { return (double) this.height; } - public double Y() { + public double ae() { return (double) this.length * 0.75D; } @@ -1439,15 +1426,15 @@ public abstract class Entity { PluginManager pluginManager = Bukkit.getPluginManager(); this.getBukkitEntity(); // make sure bukkitEntity is initialised // CraftBukkit end - this.f = 0.0D; this.g = 0.0D; + this.h = 0.0D; if (entity == null) { if (this.vehicle != null) { // CraftBukkit start if ((this.bukkitEntity instanceof LivingEntity)) { VehicleExitEvent event = new VehicleExitEvent(this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity); pluginManager.callEvent(event); - + if (event.isCancelled() || this.vehicle != originalVehicle) { return; } @@ -1473,7 +1460,7 @@ public abstract class Entity { } } - if ((entity.getBukkitEntity() instanceof Vehicle)) + if (entity.getBukkitEntity() instanceof Vehicle) { VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity); pluginManager.callEvent(event); @@ -1501,31 +1488,31 @@ public abstract class Entity { } } - public float Z() { + public float af() { return 0.1F; } - public Vec3D aa() { + public Vec3D ag() { return null; } - public void ab() { + public void ah() { if (this.portalCooldown > 0) { - this.portalCooldown = this.ac(); + this.portalCooldown = this.ai(); } else { double d0 = this.lastX - this.locX; double d1 = this.lastZ - this.locZ; - if (!this.world.isStatic && !this.ap) { - this.as = Direction.a(d0, d1); + if (!this.world.isStatic && !this.ao) { + this.ar = Direction.a(d0, d1); } - this.ap = true; + this.ao = true; } } - public int ac() { - return 900; + public int ai() { + return 300; } public ItemStack[] getEquipment() { @@ -1535,15 +1522,17 @@ public abstract class Entity { public void setEquipment(int i, ItemStack itemstack) {} public boolean isBurning() { - return !this.fireProof && (this.fireTicks > 0 || this.f(0)); + boolean flag = this.world != null && this.world.isStatic; + + return !this.fireProof && (this.fireTicks > 0 || flag && this.g(0)); } - public boolean ag() { + public boolean am() { return this.vehicle != null; } public boolean isSneaking() { - return this.f(1); + return this.g(1); } public void setSneaking(boolean flag) { @@ -1551,7 +1540,7 @@ public abstract class Entity { } public boolean isSprinting() { - return this.f(3); + return this.g(3); } public void setSprinting(boolean flag) { @@ -1559,11 +1548,10 @@ public abstract class Entity { } public boolean isInvisible() { - return this.f(5); + return this.g(5); } - - public void setInvisible(boolean flag) { - + + public void setInvisible(boolean flag) { if (Invisible && !flag) return; @@ -1574,7 +1562,7 @@ public abstract class Entity { this.a(4, flag); } - protected boolean f(int i) { + protected boolean g(int i) { return (this.datawatcher.getByte(0) & 1 << i) != 0; } @@ -1611,7 +1599,7 @@ public abstract class Entity { } } - EntityDamageEvent event = org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callEntityDamageEvent(entitylightning, this, EntityDamageEvent.DamageCause.LIGHTNING, 5D); + EntityDamageEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityDamageEvent(entitylightning, this, EntityDamageEvent.DamageCause.LIGHTNING, 5D); if (event.isCancelled()) { return; } @@ -1633,7 +1621,7 @@ public abstract class Entity { public void a(EntityLiving entityliving) {} - protected boolean i(double d0, double d1, double d2) { + protected boolean j(double d0, double d1, double d2) { int i = MathHelper.floor(d0); int j = MathHelper.floor(d1); int k = MathHelper.floor(d2); @@ -1642,15 +1630,15 @@ public abstract class Entity { double d5 = d2 - (double) k; List list = this.world.a(this.boundingBox); - if (list.isEmpty() && !this.world.v(i, j, k)) { + if (list.isEmpty() && !this.world.q(i, j, k)) { return false; } else { - boolean flag = !this.world.v(i - 1, j, k); - boolean flag1 = !this.world.v(i + 1, j, k); - boolean flag2 = !this.world.v(i, j - 1, k); - boolean flag3 = !this.world.v(i, j + 1, k); - boolean flag4 = !this.world.v(i, j, k - 1); - boolean flag5 = !this.world.v(i, j, k + 1); + boolean flag = !this.world.q(i - 1, j, k); + boolean flag1 = !this.world.q(i + 1, j, k); + boolean flag2 = !this.world.q(i, j - 1, k); + boolean flag3 = !this.world.q(i, j + 1, k); + boolean flag4 = !this.world.q(i, j, k - 1); + boolean flag5 = !this.world.q(i, j, k + 1); byte b0 = 3; double d6 = 9999.0D; @@ -1709,12 +1697,12 @@ public abstract class Entity { } } - public void am() { - this.K = true; + public void as() { + this.J = true; this.fallDistance = 0.0F; } - public String getLocalizedName() { + public String getName() { String s = EntityTypes.b(this); if (s == null) { @@ -1724,7 +1712,7 @@ public abstract class Entity { return LocaleI18n.get("entity." + s + ".name"); } - public Entity[] ao() { + public Entity[] at() { return null; } @@ -1736,7 +1724,7 @@ public abstract class Entity { return 0.0F; } - public boolean aq() { + public boolean av() { return true; } @@ -1745,7 +1733,7 @@ public abstract class Entity { } public String toString() { - return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getLocalizedName(), Integer.valueOf(this.id), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)}); + return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] { this.getClass().getSimpleName(), this.getName(), Integer.valueOf(this.id), this.world == null ? "~NULL~" : this.world.getWorldData().getName(), Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)}); } public boolean isInvulnerable() { @@ -1762,7 +1750,7 @@ public abstract class Entity { entity.e(nbttagcompound); this.f(nbttagcompound); this.portalCooldown = entity.portalCooldown; - this.as = entity.as; + this.ar = entity.ar; } public void b(int i) { @@ -1785,11 +1773,11 @@ public abstract class Entity { Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null; boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.v1_6_R3.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.v1_7_R1.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent); event.useTravelAgent(useTravelAgent); event.getEntity().getServer().getPluginManager().callEvent(event); - if (event.isCancelled() || event.getTo() == null || !this.isAlive()) { + if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null || !this.isAlive()) { return; } exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); @@ -1854,19 +1842,19 @@ public abstract class Entity { return block.a(this); } - public boolean a(Explosion explosion, World world, int i, int j, int k, int l, float f) { + public boolean a(Explosion explosion, World world, int i, int j, int k, Block block, float f) { return true; } - public int as() { + public int ax() { return 3; } - public int at() { - return this.as; + public int ay() { + return this.ar; } - public boolean au() { + public boolean az() { return false; } @@ -1883,11 +1871,13 @@ public abstract class Entity { return this.uniqueID; } - public boolean ax() { + public boolean aC() { return true; } - public String getScoreboardDisplayName() { - return this.getLocalizedName(); + public IChatBaseComponent getScoreboardDisplayName() { + return new ChatComponentText(this.getName()); } + + public void i(int i) {} } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityBat.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityBat.java similarity index 67% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityBat.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityBat.java index 3be82dd9a..9ee094149 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityBat.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityBat.java @@ -1,127 +1,133 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.Calendar; import java.util.Random; -public class EntityBat extends EntityAmbient +public class EntityBat + extends EntityAmbient { private ChunkCoordinates h; - + public boolean Vegetated = false; public EntityBat(World paramWorld) { super(paramWorld); - + a(0.5F, 0.9F); a(true); } - - protected void a() + + protected void c() { - super.a(); - + super.c(); + this.datawatcher.a(16, new Byte((byte)0)); } - - protected float ba() + + protected float bf() { return 0.1F; } - - protected float bb() + + protected float bg() { - return super.bb() * 0.95F; + return super.bg() * 0.95F; } - - protected String r() + + protected String t() { - if ((bJ()) && (this.random.nextInt(4) != 0)) { + if ((bN()) && (this.random.nextInt(4) != 0)) { return null; } return "mob.bat.idle"; } - - protected String aO() + + protected String aT() { return "mob.bat.hurt"; } - - protected String aP() + + protected String aU() { return "mob.bat.death"; } - - public boolean M() + + public boolean S() { return false; } - - protected void n(Entity paramEntity) + + protected void n(Entity paramEntity) {} + + protected void bo() {} + + protected void aD() { - } - - protected void bj() - { - } - - protected void az() - { - super.az(); - + super.aD(); + getAttributeInstance(GenericAttributes.a).setValue(6.0D); } - - public boolean bJ() { + + public boolean bN() + { return (this.datawatcher.getByte(16) & 0x1) != 0; } - - public void a(boolean paramBoolean) { + + public void a(boolean paramBoolean) + { int i = this.datawatcher.getByte(16); - if (paramBoolean) + if (paramBoolean) { this.datawatcher.watch(16, Byte.valueOf((byte)(i | 0x1))); - else + } else { this.datawatcher.watch(16, Byte.valueOf((byte)(i & 0xFFFFFFFE))); + } } - - protected boolean bf() + + protected boolean bk() { return true; } - - public void l_() + + public void h() { - super.l_(); - + super.h(); + if (Vegetated) return; - if (bJ()) { + if (bN()) + { this.motX = (this.motY = this.motZ = 0.0D); this.locY = (MathHelper.floor(this.locY) + 1.0D - this.length); - } else { + } + else + { this.motY *= 0.6000000238418579D; } } - - protected void bi() + + protected void bn() { - super.bi(); - + super.bn(); + if (Vegetated) return; - if (bJ()) { - if (!this.world.u(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ))) { + if (bN()) + { + if (!this.world.getType(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ)).r()) + { a(false); this.world.a(null, 1015, (int)this.locX, (int)this.locY, (int)this.locZ, 0); } - else { + else + { if (this.random.nextInt(200) == 0) { this.aP = this.random.nextInt(360); } - - if (this.world.findNearbyPlayer(this, 4.0D) != null) { + if (this.world.findNearbyPlayer(this, 4.0D) != null) + { a(false); this.world.a(null, 1015, (int)this.locX, (int)this.locY, (int)this.locZ, 0); } @@ -135,87 +141,85 @@ public class EntityBat extends EntityAmbient if ((this.h == null) || (this.random.nextInt(30) == 0) || (this.h.e((int)this.locX, (int)this.locY, (int)this.locZ) < 4.0F)) { this.h = new ChunkCoordinates((int)this.locX + this.random.nextInt(7) - this.random.nextInt(7), (int)this.locY + this.random.nextInt(6) - 2, (int)this.locZ + this.random.nextInt(7) - this.random.nextInt(7)); } - double d1 = this.h.x + 0.5D - this.locX; double d2 = this.h.y + 0.1D - this.locY; double d3 = this.h.z + 0.5D - this.locZ; - + this.motX += (Math.signum(d1) * 0.5D - this.motX) * 0.1000000014901161D; this.motY += (Math.signum(d2) * 0.699999988079071D - this.motY) * 0.1000000014901161D; this.motZ += (Math.signum(d3) * 0.5D - this.motZ) * 0.1000000014901161D; - + float f1 = (float)(Math.atan2(this.motZ, this.motX) * 180.0D / 3.141592741012573D) - 90.0F; float f2 = MathHelper.g(f1 - this.yaw); this.bf = 0.5F; this.yaw += f2; - - if ((this.random.nextInt(100) == 0) && (this.world.u(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ)))) + if ((this.random.nextInt(100) == 0) && (this.world.getType(MathHelper.floor(this.locX), (int)this.locY + 1, MathHelper.floor(this.locZ)).r())) { a(true); + } } } - - protected boolean e_() + + protected boolean g_() { return false; } - - protected void b(float paramFloat) - { - } - - protected void a(double paramDouble, boolean paramBoolean) - { - } - - public boolean au() + + protected void b(float paramFloat) {} + + protected void a(double paramDouble, boolean paramBoolean) {} + + public boolean az() { return true; } - + public boolean damageEntity(DamageSource paramDamageSource, float paramFloat) { - if (isInvulnerable()) return false; - if ((!this.world.isStatic) && bJ() && !Vegetated) { + if (isInvulnerable()) { + return false; + } + if ((!this.world.isStatic) && + (bN()) && + !Vegetated) { a(false); } - return super.damageEntity(paramDamageSource, paramFloat); } - + public void a(NBTTagCompound paramNBTTagCompound) { super.a(paramNBTTagCompound); - + this.datawatcher.watch(16, Byte.valueOf(paramNBTTagCompound.getByte("BatFlags"))); } - + public void b(NBTTagCompound paramNBTTagCompound) { super.b(paramNBTTagCompound); - + paramNBTTagCompound.setByte("BatFlags", this.datawatcher.getByte(16)); } - + public boolean canSpawn() { int i = MathHelper.floor(this.boundingBox.b); - if (i >= 63) return false; - - int j = MathHelper.floor(this.locX); - int k = MathHelper.floor(this.locZ); - - int m = this.world.getLightLevel(j, i, k); - int n = 4; - Calendar localCalendar = this.world.W(); - - if (((localCalendar.get(2) + 1 == 10) && (localCalendar.get(5) >= 20)) || ((localCalendar.get(2) + 1 == 11) && (localCalendar.get(5) <= 3))) - n = 7; - else if (this.random.nextBoolean()) { + if (i >= 63) { + return false; + } + int j = MathHelper.floor(this.locX); + int k = MathHelper.floor(this.locZ); + + int m = this.world.getLightLevel(j, i, k); + int n = 4; + Calendar localCalendar = this.world.V(); + if (((localCalendar.get(2) + 1 == 10) && (localCalendar.get(5) >= 20)) || ((localCalendar.get(2) + 1 == 11) && (localCalendar.get(5) <= 3))) { + n = 7; + } else if (this.random.nextBoolean()) { + return false; + } + if (m > this.random.nextInt(n)) { return false; } - - if (m > this.random.nextInt(n)) return false; - return super.canSpawn(); } -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityBlaze.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityBlaze.java similarity index 75% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityBlaze.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityBlaze.java index c84615e48..fe8164562 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityBlaze.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityBlaze.java @@ -1,14 +1,4 @@ -package net.minecraft.server.v1_6_R3; - -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityMonster; -import net.minecraft.server.v1_6_R3.EntitySmallFireball; -import net.minecraft.server.v1_6_R3.GenericAttributes; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.World; +package net.minecraft.server.v1_7_R1; public class EntityBlaze extends EntityMonster { @@ -22,25 +12,25 @@ public class EntityBlaze extends EntityMonster { this.b = 10; } - protected void az() { - super.az(); + protected void aD() { + super.aD(); this.getAttributeInstance(GenericAttributes.e).setValue(6.0D); } - protected void a() { - super.a(); + protected void c() { + super.c(); this.datawatcher.a(16, new Byte((byte) 0)); } - protected String r() { + protected String t() { return "mob.blaze.breathe"; } - protected String aO() { + protected String aT() { return "mob.blaze.hit"; } - protected String aP() { + protected String aU() { return "mob.blaze.death"; } @@ -48,9 +38,9 @@ public class EntityBlaze extends EntityMonster { return 1.0F; } - public void c() { + public void e() { if (!this.world.isStatic) { - if (this.G()) { + if (this.L()) { this.damageEntity(DamageSource.DROWN, 1.0F); } @@ -60,7 +50,7 @@ public class EntityBlaze extends EntityMonster { this.bp = 0.5F + (float) this.random.nextGaussian() * 3.0F; } - if (this.bN() != null && this.bN().locY + (double) this.bN().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) { + if (this.bR() != null && this.bR().locY + (double) this.bR().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) { this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D; } } @@ -77,7 +67,7 @@ public class EntityBlaze extends EntityMonster { this.world.addParticle("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D); } - super.c(); + super.e(); } protected void a(Entity entity, float f) { @@ -126,30 +116,31 @@ public class EntityBlaze extends EntityMonster { protected void b(float f) {} - protected int getLootId() { - return Item.BLAZE_ROD.id; + protected Item getLoot() { + return Items.BLAZE_ROD; } public boolean isBurning() { - return this.bT(); + return this.bX(); } protected void dropDeathLoot(boolean flag, int i) { + // CraftBukkit start + java.util.List loot = new java.util.ArrayList(); + if (flag) { - // CraftBukkit start - java.util.List loot = new java.util.ArrayList(); int j = this.random.nextInt(2 + i); if (j > 0) { - loot.add(new org.bukkit.inventory.ItemStack(Item.BLAZE_ROD.id, j)); + loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers.getMaterial(Items.BLAZE_ROD), j)); } - - org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callEntityDeathEvent(this, loot); - // CraftBukkit end } + + org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityDeathEvent(this, loot); + // CraftBukkit end } - public boolean bT() { + public boolean bX() { return (this.datawatcher.getByte(16) & 1) != 0; } @@ -165,7 +156,7 @@ public class EntityBlaze extends EntityMonster { this.datawatcher.watch(16, Byte.valueOf(b0)); } - protected boolean i_() { + protected boolean j_() { return true; } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityCreature.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityCreature.java new file mode 100644 index 000000000..d2208b666 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityCreature.java @@ -0,0 +1,313 @@ +package net.minecraft.server.v1_7_R1; + +import java.util.UUID; + +// CraftBukkit start +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityUnleashEvent; +// CraftBukkit end + +public abstract class EntityCreature extends EntityInsentient { + + public static final UUID h = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); + public static final AttributeModifier i = (new AttributeModifier(h, "Fleeing speed bonus", 2.0D, 2)).a(false); + public PathEntity pathEntity; // CraftBukkit - private -> public + public Entity target; // CraftBukkit - protected -> public + protected boolean bn; + protected int bo; + private ChunkCoordinates bq = new ChunkCoordinates(0, 0, 0); + private float br = -1.0F; + private PathfinderGoal bs = new PathfinderGoalMoveTowardsRestriction(this, 1.0D); + private boolean bt; + + public EntityCreature(World world) { + super(world); + } + + protected boolean bN() { + return false; + } + + protected void bq() { + this.world.methodProfiler.a("ai"); + if (this.bo > 0 && --this.bo == 0) { + AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); + + attributeinstance.b(i); + } + + this.bn = this.bN(); + float f11 = 16.0F; + + if (this.target == null) { + // CraftBukkit start + Entity target = this.findTarget(); + if (target != null) { + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + if (event.getTarget() == null) { + this.target = null; + } else { + this.target = ((CraftEntity) event.getTarget()).getHandle(); + } + } + } + // CraftBukkit end + + if (this.target != null) { + this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true); + } + } else if (this.target.isAlive()) { + float f1 = this.target.d((Entity) this); + + if (this.o(this.target)) { + this.a(this.target, f1); + } + } else { + // CraftBukkit start + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + if (event.getTarget() == null) { + this.target = null; + } else { + this.target = ((CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end + } + + if (this.target instanceof EntityPlayer && ((EntityPlayer) this.target).playerInteractManager.isCreative()) { + this.target = null; + } + + this.world.methodProfiler.b(); + if (!this.bn && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) { + this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true); + } else if (!this.bn && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.bo > 0) && this.aV < 100) { + this.bO(); + } + + int i = MathHelper.floor(this.boundingBox.b + 0.5D); + boolean flag = this.M(); + boolean flag1 = this.P(); + + this.pitch = 0.0F; + if (this.pathEntity != null && this.random.nextInt(100) != 0) { + this.world.methodProfiler.a("followpath"); + Vec3D vec3d = this.pathEntity.a((Entity) this); + double d0 = (double) (this.width * 2.0F); + + while (vec3d != null && vec3d.d(this.locX, vec3d.d, this.locZ) < d0 * d0) { + this.pathEntity.a(); + if (this.pathEntity.b()) { + vec3d = null; + this.pathEntity = null; + } else { + vec3d = this.pathEntity.a((Entity) this); + } + } + + this.bd = false; + if (vec3d != null) { + double d1 = vec3d.c - this.locX; + double d2 = vec3d.e - this.locZ; + double d3 = vec3d.d - (double) i; + // CraftBukkit - Math -> TrigMath + float f2 = (float) (org.bukkit.craftbukkit.v1_7_R1.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; + float f3 = MathHelper.g(f2 - this.yaw); + + this.bf = (float) this.getAttributeInstance(GenericAttributes.d).getValue(); + if (f3 > 30.0F) { + f3 = 30.0F; + } + + if (f3 < -30.0F) { + f3 = -30.0F; + } + + this.yaw += f3; + if (this.bn && this.target != null) { + double d4 = this.target.locX - this.locX; + double d5 = this.target.locZ - this.locZ; + float f4 = this.yaw; + + this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F; + f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F; + this.be = -MathHelper.sin(f3) * this.bf * 1.0F; + this.bf = MathHelper.cos(f3) * this.bf * 1.0F; + } + + if (d3 > 0.0D) { + this.bd = true; + } + } + + if (this.target != null) { + this.a(this.target, 30.0F, 30.0F); + } + + if (this.positionChanged && !this.bQ()) { + this.bd = true; + } + + if (this.random.nextFloat() < 0.8F && (flag || flag1)) { + this.bd = true; + } + + this.world.methodProfiler.b(); + } else { + super.bq(); + this.pathEntity = null; + } + } + + protected void bO() { + this.world.methodProfiler.a("stroll"); + boolean flag = false; + int i = -1; + int j = -1; + int k = -1; + float f = -99999.0F; + + for (int l = 0; l < 10; ++l) { + int i1 = MathHelper.floor(this.locX + (double) this.random.nextInt(13) - 6.0D); + int j1 = MathHelper.floor(this.locY + (double) this.random.nextInt(7) - 3.0D); + int k1 = MathHelper.floor(this.locZ + (double) this.random.nextInt(13) - 6.0D); + float f1 = this.a(i1, j1, k1); + + if (f1 > f) { + f = f1; + i = i1; + j = j1; + k = k1; + flag = true; + } + } + + if (flag) { + this.pathEntity = this.world.a(this, i, j, k, 10.0F, true, false, false, true); + } + + this.world.methodProfiler.b(); + } + + protected void a(Entity entity, float f) {} + + public float a(int i, int j, int k) { + return 0.0F; + } + + protected Entity findTarget() { + return null; + } + + public boolean canSpawn() { + int i = MathHelper.floor(this.locX); + int j = MathHelper.floor(this.boundingBox.b); + int k = MathHelper.floor(this.locZ); + + return super.canSpawn() && this.a(i, j, k) >= 0.0F; + } + + public boolean bQ() { + return this.pathEntity != null; + } + + public void setPathEntity(PathEntity pathentity) { + this.pathEntity = pathentity; + } + + public Entity bR() { + return this.target; + } + + public void setTarget(Entity entity) { + this.target = entity; + } + + public boolean bS() { + return this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + } + + public boolean b(int i, int j, int k) { + return this.br == -1.0F ? true : this.bq.e(i, j, k) < this.br * this.br; + } + + public void a(int i, int j, int k, int l) { + this.bq.b(i, j, k); + this.br = (float) l; + } + + public ChunkCoordinates bT() { + return this.bq; + } + + public float bU() { + return this.br; + } + + public void bV() { + this.br = -1.0F; + } + + public boolean bW() { + return this.br != -1.0F; + } + + protected void bJ() { + super.bJ(); + if (this.bL() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world && this.PullWhileLeashed) { + Entity entity = this.getLeashHolder(); + + this.a((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5); + float f = this.d(entity); + + if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) { + if (f > 10.0F) { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit + this.unleash(true, true); + } + + return; + } + + if (!this.bt) { + this.goalSelector.a(2, this.bs); + this.getNavigation().a(false); + this.bt = true; + } + + this.o(f); + if (f > 4.0F) { + this.getNavigation().a(entity, 1.0D); + } + + if (f > 6.0F) { + double d0 = (entity.locX - this.locX) / (double) f; + double d1 = (entity.locY - this.locY) / (double) f; + double d2 = (entity.locZ - this.locZ) / (double) f; + + this.motX += d0 * Math.abs(d0) * 0.4D; + this.motY += d1 * Math.abs(d1) * 0.4D; + this.motZ += d2 * Math.abs(d2) * 0.4D; + } + + if (f > 10.0F) { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit + this.unleash(true, true); + } + } else if (!this.bL() && this.bt) { + this.bt = false; + this.goalSelector.a(this.bs); + this.getNavigation().a(true); + this.bV(); + } + } + + protected void o(float f) {} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityEnderDragon.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityEnderDragon.java similarity index 83% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityEnderDragon.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityEnderDragon.java index fdef7a36f..bc9c83754 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityEnderDragon.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityEnderDragon.java @@ -1,14 +1,16 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.Iterator; import java.util.List; // CraftBukkit start import org.bukkit.block.BlockState; -import org.bukkit.craftbukkit.v1_6_R3.util.BlockStateListPopulator; +import org.bukkit.craftbukkit.v1_7_R1.util.BlockStateListPopulator; import org.bukkit.event.entity.EntityCreatePortalEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.Bukkit; // CraftBukkit end @@ -43,19 +45,19 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo this.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = new EntityComplexPart(this, "wing", 4.0F, 4.0F)}; this.setHealth(this.getMaxHealth()); this.a(16.0F, 8.0F); - this.Z = true; + this.Y = true; this.fireProof = true; this.i = 100.0D; - this.am = true; + this.al = true; } - protected void az() { - super.az(); + protected void aD() { + super.aD(); this.getAttributeInstance(GenericAttributes.a).setValue(200.0D); } - protected void a() { - super.a(); + protected void c() { + super.c(); } public double[] b(int i, float f) { @@ -78,7 +80,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo return adouble; } - public void c() { + public void e() { float f; float f1; @@ -99,7 +101,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo f2 = (this.random.nextFloat() - 0.5F) * 8.0F; this.world.addParticle("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D); } else { - this.bJ(); + this.bN(); f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F); f *= (float) Math.pow(2.0D, this.motY); if (this.bA) { @@ -163,8 +165,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo this.j += this.random.nextGaussian() * 2.0D; } - if (!Vegetated && (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.H)) { - this.bK(); + if (!Vegetated && (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G)) { + this.bO(); } d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2); @@ -245,11 +247,11 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo float f11 = MathHelper.sin(f10); float f12 = MathHelper.cos(f10); - this.br.l_(); + this.br.h(); this.br.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F); - this.bv.l_(); + this.bv.h(); this.bv.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F); - this.bw.l_(); + this.bw.h(); this.bw.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F); if (!this.world.isStatic && this.hurtTicks == 0 && !ghost) { this.a(this.world.getEntities(this, this.bv.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D))); @@ -263,7 +265,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bg * 0.01F); float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bg * 0.01F); - this.bq.l_(); + this.bq.h(); this.bq.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F); for (int j = 0; j < 3; ++j) { @@ -288,7 +290,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo float f17 = 1.5F; float f18 = (float) (j + 1) * 2.0F; - entitycomplexpart.l_(); + entitycomplexpart.h(); entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f2), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f2), 0.0F, 0.0F); } @@ -298,15 +300,23 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo } } - private void bJ() { + private void bN() { if (this.bC != null) { if (this.bC.dead) { if (!this.world.isStatic) { - this.a(this.bq, DamageSource.explosion((Explosion) null), 10.0F); + // CraftBukkit start + EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, 10.0F); + Bukkit.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + getBukkitEntity().setLastDamageCause(event); + this.a(this.bq, DamageSource.explosion((Explosion) null), (float) event.getDamage()); + } + // CraftBukkit end } this.bC = null; - } else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth + } else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) { // CraftBukkit start EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0D, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL); this.world.getServer().getPluginManager().callEvent(event); @@ -380,10 +390,22 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo this.bD = entity; } - private void bK() { + private void bO() { this.bz = false; if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) { - this.bD = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); + // CraftBukkit start + Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + if (event.getTarget() == null) { + this.bD = null; + } else { + this.bD = ((org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end } else { boolean flag = false; @@ -420,16 +442,16 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo // CraftBukkit start - Create a list to hold all the destroyed blocks List destroyedBlocks = new java.util.ArrayList(); - org.bukkit.craftbukkit.v1_6_R3.CraftWorld craftWorld = this.world.getWorld(); + org.bukkit.craftbukkit.v1_7_R1.CraftWorld craftWorld = this.world.getWorld(); // CraftBukkit end for (int k1 = i; k1 <= l; ++k1) { for (int l1 = j; l1 <= i1; ++l1) { for (int i2 = k; i2 <= j1; ++i2) { - int j2 = this.world.getTypeId(k1, l1, i2); + Block block = this.world.getType(k1, l1, i2); - if (j2 != 0) { - if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id && this.world.getGameRules().getBoolean("mobGriefing")) { + if (block.getMaterial() != Material.AIR) { + if (block != Blocks.OBSIDIAN && block != Blocks.WHITESTONE && block != Blocks.BEDROCK && this.world.getGameRules().getBoolean("mobGriefing")) { // CraftBukkit start - Add blocks to list rather than destroying them // flag1 = this.world.setAir(k1, l1, i2) || flag1; flag1 = true; @@ -459,9 +481,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo } } else { for (org.bukkit.block.Block block : event.blockList()) { - int blockId = block.getTypeId(); - - if (blockId == 0) { + org.bukkit.Material blockId = block.getType(); + if (blockId == org.bukkit.Material.AIR) { continue; } @@ -469,10 +490,11 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo int blockY = block.getY(); int blockZ = block.getZ(); - if (Block.byId[blockId].a(explosionSource)) { - Block.byId[blockId].dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0); + Block nmsBlock = org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers.getBlock(blockId); + if (nmsBlock.a(explosionSource)) { + nmsBlock.dropNaturally(this.world, blockX, blockY, blockZ, block.getData(), event.getYield(), 0); } - Block.byId[blockId].wasExploded(world, blockX, blockY, blockZ, explosionSource); + nmsBlock.wasExploded(world, blockX, blockY, blockZ, explosionSource); this.world.setAir(blockX, blockY, blockZ); } @@ -517,7 +539,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo return super.damageEntity(damagesource, f); } - protected void aB() { + protected void aF() { + if (this.dead) return; // CraftBukkit - can't kill what's already dead ++this.bB; if (this.bB >= 180 && this.bB <= 200) { float f = (this.random.nextFloat() - 0.5F) * 8.0F; @@ -532,7 +555,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo if (!this.world.isStatic) { if (this.bB > 150 && this.bB % 5 == 0) { - i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward() + i = this.expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward() while (i > 0) { j = EntityExperienceOrb.getOrbValue(i); @@ -542,14 +565,14 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo } if (this.bB == 1) { - this.world.d(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0); + this.world.b(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0); } } this.move(0.0D, 0.10000000149011612D, 0.0D); this.aN = this.yaw += 20.0F; if (this.bB == 200 && !this.world.isStatic) { - i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience + i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience while (i > 0) { j = EntityExperienceOrb.getOrbValue(i); @@ -557,12 +580,12 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo this.world.addEntity(new EntityExperienceOrb(this.world, this.locX, this.locY, this.locZ, j)); } - this.c(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); + this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); this.die(); } } - private void c(int i, int j) { + private void b(int i, int j) { byte b0 = 64; BlockEnderPortal.a = true; @@ -581,29 +604,29 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo if (d2 <= ((double) b1 - 0.5D) * ((double) b1 - 0.5D)) { if (k < b0) { if (d2 <= ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) { - world.setTypeId(l, k, i1, Block.BEDROCK.id); + world.setTypeUpdate(l, k, i1, Blocks.BEDROCK); } } else if (k > b0) { - world.setTypeId(l, k, i1, 0); + world.setTypeUpdate(l, k, i1, Blocks.AIR); } else if (d2 > ((double) (b1 - 1) - 0.5D) * ((double) (b1 - 1) - 0.5D)) { - world.setTypeId(l, k, i1, Block.BEDROCK.id); + world.setTypeUpdate(l, k, i1, Blocks.BEDROCK); } else { - world.setTypeId(l, k, i1, Block.ENDER_PORTAL.id); + world.setTypeUpdate(l, k, i1, Blocks.ENDER_PORTAL); } } } } } - world.setTypeId(i, b0 + 0, j, Block.BEDROCK.id); - world.setTypeId(i, b0 + 1, j, Block.BEDROCK.id); - world.setTypeId(i, b0 + 2, j, Block.BEDROCK.id); - world.setTypeId(i - 1, b0 + 2, j, Block.TORCH.id); - world.setTypeId(i + 1, b0 + 2, j, Block.TORCH.id); - world.setTypeId(i, b0 + 2, j - 1, Block.TORCH.id); - world.setTypeId(i, b0 + 2, j + 1, Block.TORCH.id); - world.setTypeId(i, b0 + 3, j, Block.BEDROCK.id); - world.setTypeId(i, b0 + 4, j, Block.DRAGON_EGG.id); + world.setType(i, b0 + 0, j, Blocks.BEDROCK); + world.setType(i, b0 + 1, j, Blocks.BEDROCK); + world.setType(i, b0 + 2, j, Blocks.BEDROCK); + world.setTypeAndData(i - 1, b0 + 2, j, Blocks.TORCH, 2, 0); + world.setTypeAndData(i + 1, b0 + 2, j, Blocks.TORCH, 1, 0); + world.setTypeAndData(i, b0 + 2, j - 1, Blocks.TORCH, 4, 0); + world.setTypeAndData(i, b0 + 2, j + 1, Blocks.TORCH, 3, 0); + world.setType(i, b0 + 3, j, Blocks.BEDROCK); + world.setType(i, b0 + 4, j, Blocks.DRAGON_EGG); EntityCreatePortalEvent event = new EntityCreatePortalEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), java.util.Collections.unmodifiableList(world.getList()), org.bukkit.PortalType.ENDER); this.world.getServer().getPluginManager().callEvent(event); @@ -614,7 +637,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo } } else { for (BlockState state : event.getBlocks()) { - Packet53BlockChange packet = new Packet53BlockChange(state.getX(), state.getY(), state.getZ(), this.world); + PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(state.getX(), state.getY(), state.getZ(), this.world); for (Iterator it = this.world.players.iterator(); it.hasNext();) { EntityHuman entity = (EntityHuman) it.next(); if (entity instanceof EntityPlayer) { @@ -628,29 +651,29 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo BlockEnderPortal.a = false; } - protected void u() {} + protected void w() {} - public Entity[] ao() { + public Entity[] at() { return this.children; } - public boolean L() { + public boolean R() { return false; } - public World b() { + public World a() { return this.world; } - protected String r() { + protected String t() { return "mob.enderdragon.growl"; } - protected String aO() { + protected String aT() { return "mob.enderdragon.hit"; } - protected float ba() { + protected float bf() { return 5.0F; } @@ -661,4 +684,4 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo return 12000; } // CraftBukkit end -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityEnderman.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityEnderman.java similarity index 74% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityEnderman.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityEnderman.java index dd6a32992..41fcb2874 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityEnderman.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityEnderman.java @@ -1,27 +1,10 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.UUID; -import net.minecraft.server.v1_6_R3.AttributeInstance; -import net.minecraft.server.v1_6_R3.AttributeModifier; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityDamageSource; -import net.minecraft.server.v1_6_R3.EntityDamageSourceIndirect; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityMonster; -import net.minecraft.server.v1_6_R3.GenericAttributes; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.Vec3D; -import net.minecraft.server.v1_6_R3.World; - // CraftBukkit start import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; import org.bukkit.event.entity.EntityTeleportEvent; // CraftBukkit end @@ -38,18 +21,18 @@ public class EntityEnderman extends EntityMonster { public EntityEnderman(World world) { super(world); this.a(0.6F, 2.9F); - this.Y = 1.0F; + this.X = 1.0F; } - protected void az() { - super.az(); + protected void aD() { + super.aD(); this.getAttributeInstance(GenericAttributes.a).setValue(40.0D); this.getAttributeInstance(GenericAttributes.d).setValue(0.30000001192092896D); this.getAttributeInstance(GenericAttributes.e).setValue(7.0D); } - protected void a() { - super.a(); + protected void c() { + super.c(); this.datawatcher.a(16, new Byte((byte) 0)); this.datawatcher.a(17, new Byte((byte) 0)); this.datawatcher.a(18, new Byte((byte) 0)); @@ -57,13 +40,13 @@ public class EntityEnderman extends EntityMonster { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.setShort("carried", (short) this.getCarriedId()); + nbttagcompound.setShort("carried", (short) Block.b(this.getCarried())); nbttagcompound.setShort("carriedData", (short) this.getCarriedData()); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.setCarriedId(nbttagcompound.getShort("carried")); + this.setCarried(Block.e(nbttagcompound.getShort("carried"))); this.setCarriedData(nbttagcompound.getShort("carriedData")); } @@ -77,7 +60,7 @@ public class EntityEnderman extends EntityMonster { if (this.f(entityhuman)) { this.bv = true; if (this.bt == 0) { - this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F); + this.world.makeSound(entityhuman.locX, entityhuman.locY, entityhuman.locZ, "mob.endermen.stare", 1.0F, 1.0F); } if (this.bt++ == 5) { @@ -96,7 +79,7 @@ public class EntityEnderman extends EntityMonster { private boolean f(EntityHuman entityhuman) { ItemStack itemstack = entityhuman.inventory.armor[3]; - if (itemstack != null && itemstack.id == Block.PUMPKIN.id) { + if (itemstack != null && itemstack.getItem() == Item.getItemOf(Blocks.PUMPKIN)) { return false; } else { Vec3D vec3d = entityhuman.j(1.0F).a(); @@ -110,8 +93,8 @@ public class EntityEnderman extends EntityMonster { } } - public void c() { - if (this.G()) { + public void e() { + if (this.L()) { this.damageEntity(DamageSource.DROWN, 1.0F); } @@ -130,20 +113,20 @@ public class EntityEnderman extends EntityMonster { if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) { int j; int k; - int l; + Block block; - if (this.getCarriedId() == 0) { + if (this.getCarried().getMaterial() == Material.AIR) { if (this.random.nextInt(20) == 0) { i = MathHelper.floor(this.locX - 2.0D + this.random.nextDouble() * 4.0D); j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D); k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D); - l = this.world.getTypeId(i, j, k); - if (br[l]) { + block = this.world.getType(i, j, k); + if (br[Block.b(block)]) { // CraftBukkit start - Pickup event if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) { - this.setCarriedId(this.world.getTypeId(i, j, k)); + this.setCarried(block); this.setCarriedData(this.world.getData(i, j, k)); - this.world.setTypeIdUpdate(i, j, k, 0); + this.world.setTypeUpdate(i, j, k, Blocks.AIR); } // CraftBukkit end } @@ -152,14 +135,14 @@ public class EntityEnderman extends EntityMonster { i = MathHelper.floor(this.locX - 1.0D + this.random.nextDouble() * 2.0D); j = MathHelper.floor(this.locY + this.random.nextDouble() * 2.0D); k = MathHelper.floor(this.locZ - 1.0D + this.random.nextDouble() * 2.0D); - l = this.world.getTypeId(i, j, k); - int i1 = this.world.getTypeId(i, j - 1, k); + block = this.world.getType(i, j, k); + Block block1 = this.world.getType(i, j - 1, k); - if (l == 0 && i1 > 0 && Block.byId[i1].b()) { + if (block.getMaterial() == Material.AIR && block1.getMaterial() != Material.AIR && block1.d()) { // CraftBukkit start - Place event - if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarriedId(), this.getCarriedData()).isCancelled()) { - this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3); - this.setCarriedId(0); + if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarried(), this.getCarriedData()).isCancelled()) { + this.world.setTypeAndData(i, j, k, this.getCarried(), this.getCarriedData(), 3); + this.setCarried(Blocks.AIR); } // CraftBukkit end } @@ -173,22 +156,22 @@ public class EntityEnderman extends EntityMonster { if (this.world.v() && !this.world.isStatic) { float f = this.d(1.0F); - if (f > 0.5F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { + if (f > 0.5F && this.world.i(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { this.target = null; this.a(false); this.bv = false; - this.bT(); + this.bX(); } } - if (this.G() || this.isBurning()) { + if (this.L() || this.isBurning()) { this.target = null; this.a(false); this.bv = false; - this.bT(); + this.bX(); } - if (this.bX() && !this.bv && this.random.nextInt(100) == 0) { + if (this.cb() && !this.bv && this.random.nextInt(100) == 0) { this.a(false); } @@ -201,7 +184,7 @@ public class EntityEnderman extends EntityMonster { if (this.target != null) { if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) { if (this.target.e((Entity) this) < 16.0D) { - this.bT(); + this.bX(); } this.bs = 0; @@ -214,15 +197,15 @@ public class EntityEnderman extends EntityMonster { } } - super.c(); + super.e(); } - protected boolean bT() { + protected boolean bX() { double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D; double d1 = this.locY + (double) (this.random.nextInt(64) - 32); double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D; - return this.j(d0, d1, d2); + return this.k(d0, d1, d2); } protected boolean c(Entity entity) { @@ -234,10 +217,10 @@ public class EntityEnderman extends EntityMonster { double d2 = this.locY + (double) (this.random.nextInt(16) - 8) - vec3d.d * d0; double d3 = this.locZ + (this.random.nextDouble() - 0.5D) * 8.0D - vec3d.e * d0; - return this.j(d1, d2, d3); + return this.k(d1, d2, d3); } - protected boolean j(double d0, double d1, double d2) { + protected boolean k(double d0, double d1, double d2) { double d3 = this.locX; double d4 = this.locY; double d5 = this.locZ; @@ -249,14 +232,14 @@ public class EntityEnderman extends EntityMonster { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY); int k = MathHelper.floor(this.locZ); - int l; if (this.world.isLoaded(i, j, k)) { boolean flag1 = false; while (!flag1 && j > 0) { - l = this.world.getTypeId(i, j - 1, k); - if (l != 0 && Block.byId[l].material.isSolid()) { + Block block = this.world.getType(i, j - 1, k); + + if (block.getMaterial().isSolid()) { flag1 = true; } else { --this.locY; @@ -288,7 +271,7 @@ public class EntityEnderman extends EntityMonster { } else { short short1 = 128; - for (l = 0; l < short1; ++l) { + for (int l = 0; l < short1; ++l) { double d6 = (double) l / ((double) short1 - 1.0D); float f = (this.random.nextFloat() - 0.5F) * 0.2F; float f1 = (this.random.nextFloat() - 0.5F) * 0.2F; @@ -306,32 +289,32 @@ public class EntityEnderman extends EntityMonster { } } - protected String r() { - return this.bX() ? "mob.endermen.scream" : "mob.endermen.idle"; + protected String t() { + return this.cb() ? "mob.endermen.scream" : "mob.endermen.idle"; } - protected String aO() { + protected String aT() { return "mob.endermen.hit"; } - protected String aP() { + protected String aU() { return "mob.endermen.death"; } - protected int getLootId() { - return Item.ENDER_PEARL.id; + protected Item getLoot() { + return Items.ENDER_PEARL; } protected void dropDeathLoot(boolean flag, int i) { - int j = this.getLootId(); + Item item = this.getLoot(); - if (j > 0) { + if (item != null) { // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); int count = this.random.nextInt(2 + i); - if ((j > 0) && (count > 0)) { - loot.add(new org.bukkit.inventory.ItemStack(j, count)); + if (count > 0) { + loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers.getMaterial(item), count)); } CraftEventFactory.callEntityDeathEvent(this, loot); @@ -339,12 +322,12 @@ public class EntityEnderman extends EntityMonster { } } - public void setCarriedId(int i) { - this.datawatcher.watch(16, Byte.valueOf((byte) (i & 255))); + public void setCarried(Block block) { + this.datawatcher.watch(16, Byte.valueOf((byte) (Block.b(block) & 255))); } - public int getCarriedId() { - return this.datawatcher.getByte(16); + public Block getCarried() { + return Block.e(this.datawatcher.getByte(16)); } public void setCarriedData(int i) { @@ -368,7 +351,7 @@ public class EntityEnderman extends EntityMonster { this.bv = false; for (int i = 0; i < 64; ++i) { - if (this.bT()) { + if (this.bX()) { return true; } } @@ -380,7 +363,7 @@ public class EntityEnderman extends EntityMonster { } } - public boolean bX() { + public boolean cb() { return this.datawatcher.getByte(18) > 0; } @@ -389,19 +372,19 @@ public class EntityEnderman extends EntityMonster { } static { - br[Block.GRASS.id] = true; - br[Block.DIRT.id] = true; - br[Block.SAND.id] = true; - br[Block.GRAVEL.id] = true; - br[Block.YELLOW_FLOWER.id] = true; - br[Block.RED_ROSE.id] = true; - br[Block.BROWN_MUSHROOM.id] = true; - br[Block.RED_MUSHROOM.id] = true; - br[Block.TNT.id] = true; - br[Block.CACTUS.id] = true; - br[Block.CLAY.id] = true; - br[Block.PUMPKIN.id] = true; - br[Block.MELON.id] = true; - br[Block.MYCEL.id] = true; + br[Block.b((Block) Blocks.GRASS)] = true; + br[Block.b(Blocks.DIRT)] = true; + br[Block.b(Blocks.SAND)] = true; + br[Block.b(Blocks.GRAVEL)] = true; + br[Block.b((Block) Blocks.YELLOW_FLOWER)] = true; + br[Block.b((Block) Blocks.RED_ROSE)] = true; + br[Block.b((Block) Blocks.BROWN_MUSHROOM)] = true; + br[Block.b((Block) Blocks.RED_MUSHROOM)] = true; + br[Block.b(Blocks.TNT)] = true; + br[Block.b(Blocks.CACTUS)] = true; + br[Block.b(Blocks.CLAY)] = true; + br[Block.b(Blocks.PUMPKIN)] = true; + br[Block.b(Blocks.MELON)] = true; + br[Block.b((Block) Blocks.MYCEL)] = true; } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityFallingBlock.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityFallingBlock.java new file mode 100644 index 000000000..2802245f9 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityFallingBlock.java @@ -0,0 +1,245 @@ +package net.minecraft.server.v1_7_R1; + +import java.util.ArrayList; +import java.util.Iterator; + +// CraftBukkit start +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; +import org.bukkit.event.entity.EntityDamageEvent; +// CraftBukkit end + +public class EntityFallingBlock extends Entity { + + public Block id; // CraftBukkit - private -> public + public int data; + public int b; + public boolean dropItem; + private boolean f; + private boolean hurtEntities; + private int fallHurtMax; + private float fallHurtAmount; + public NBTTagCompound tileEntityData; + + public boolean spectating; + + public EntityFallingBlock(World world) { + super(world); + this.dropItem = true; + this.fallHurtMax = 40; + this.fallHurtAmount = 2.0F; + } + + public EntityFallingBlock(World world, double d0, double d1, double d2, Block block) { + this(world, d0, d1, d2, block, 0); + } + + public EntityFallingBlock(World world, double d0, double d1, double d2, Block block, int i) { + super(world); + this.dropItem = true; + this.fallHurtMax = 40; + this.fallHurtAmount = 2.0F; + this.id = block; + this.data = i; + this.l = true; + this.a(0.98F, 0.98F); + this.height = this.length / 2.0F; + this.setPosition(d0, d1, d2); + this.motX = 0.0D; + this.motY = 0.0D; + this.motZ = 0.0D; + this.lastX = d0; + this.lastY = d1; + this.lastZ = d2; + } + + protected boolean g_() { + return false; + } + + protected void c() {} + + public boolean R() { + return !this.dead && !spectating; + } + + public void h() { + if (this.id.getMaterial() == Material.AIR) { + this.die(); + } else { + this.lastX = this.locX; + this.lastY = this.locY; + this.lastZ = this.locZ; + ++this.b; + this.motY -= 0.03999999910593033D; + this.move(this.motX, this.motY, this.motZ); + this.motX *= 0.9800000190734863D; + this.motY *= 0.9800000190734863D; + this.motZ *= 0.9800000190734863D; + if (!this.world.isStatic) { + int i = MathHelper.floor(this.locX); + int j = MathHelper.floor(this.locY); + int k = MathHelper.floor(this.locZ); + + if (this.b == 1) { + // CraftBukkit - compare data and call event + if (this.b != 1 || this.world.getType(i, j, k) != this.id || this.world.getData(i, j, k) != this.data || CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, Blocks.AIR, 0).isCancelled()) { + this.die(); + return; + } + + this.world.setAir(i, j, k); + } + + if (this.onGround) { + this.motX *= 0.699999988079071D; + this.motZ *= 0.699999988079071D; + this.motY *= -0.5D; + if (this.world.getType(i, j, k) != Blocks.PISTON_MOVING) { + this.die(); + // CraftBukkit start + if (!this.f && this.world.mayPlace(this.id, i, j, k, true, 1, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, i, j - 1, k) /* mimic the false conditions of setTypeIdAndData */ && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j > 0 && j < 256 && !(this.world.getType(i, j, k) == this.id && this.world.getData(i, j, k) == this.data)) { + if (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.id, this.data).isCancelled()) { + return; + } + this.world.setTypeAndData(i, j, k, this.id, this.data, 3); + // CraftBukkit end + + if (this.id instanceof BlockFalling) { + ((BlockFalling) this.id).a(this.world, i, j, k, this.data); + } + + if (this.tileEntityData != null && this.id instanceof IContainer) { + TileEntity tileentity = this.world.getTileEntity(i, j, k); + + if (tileentity != null) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + + tileentity.b(nbttagcompound); + Iterator iterator = this.tileEntityData.c().iterator(); + + while (iterator.hasNext()) { + String s = (String) iterator.next(); + NBTBase nbtbase = this.tileEntityData.get(s); + + if (!s.equals("x") && !s.equals("y") && !s.equals("z")) { + nbttagcompound.set(s, nbtbase.clone()); + } + } + + tileentity.a(nbttagcompound); + tileentity.update(); + } + } + } else if (this.dropItem && !this.f) { + this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F); + } + } + } else if (this.b > 100 && !this.world.isStatic && (j < 1 || j > 256) || this.b > 600) { + if (this.dropItem) { + this.a(new ItemStack(this.id, 1, this.id.getDropData(this.data)), 0.0F); + } + + this.die(); + } + } + } + } + + protected void b(float f) { + if (this.hurtEntities) { + int i = MathHelper.f(f - 1.0F); + + if (i > 0) { + ArrayList arraylist = new ArrayList(this.world.getEntities(this, this.boundingBox)); + boolean flag = this.id == Blocks.ANVIL; + DamageSource damagesource = flag ? DamageSource.ANVIL : DamageSource.FALLING_BLOCK; + Iterator iterator = arraylist.iterator(); + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + + // CraftBukkit start + float damage = (float) Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax); + + EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(this, entity, EntityDamageEvent.DamageCause.FALLING_BLOCK, damage); + if (event.isCancelled()) { + continue; + } + + entity.damageEntity(damagesource, (float) event.getDamage()); + // CraftBukkit end + } + + if (flag && (double) this.random.nextFloat() < 0.05000000074505806D + (double) i * 0.05D) { + int j = this.data >> 2; + int k = this.data & 3; + + ++j; + if (j > 2) { + this.f = true; + } else { + this.data = k | j << 2; + } + } + } + } + } + + protected void b(NBTTagCompound nbttagcompound) { + nbttagcompound.setByte("Tile", (byte) Block.b(this.id)); + nbttagcompound.setInt("TileID", Block.b(this.id)); + nbttagcompound.setByte("Data", (byte) this.data); + nbttagcompound.setByte("Time", (byte) this.b); + nbttagcompound.setBoolean("DropItem", this.dropItem); + nbttagcompound.setBoolean("HurtEntities", this.hurtEntities); + nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount); + nbttagcompound.setInt("FallHurtMax", this.fallHurtMax); + if (this.tileEntityData != null) { + nbttagcompound.set("TileEntityData", this.tileEntityData); + } + } + + protected void a(NBTTagCompound nbttagcompound) { + if (nbttagcompound.hasKeyOfType("TileID", 99)) { + this.id = Block.e(nbttagcompound.getInt("TileID")); + } else { + this.id = Block.e(nbttagcompound.getByte("Tile") & 255); + } + + this.data = nbttagcompound.getByte("Data") & 255; + this.b = nbttagcompound.getByte("Time") & 255; + if (nbttagcompound.hasKeyOfType("HurtEntities", 99)) { + this.hurtEntities = nbttagcompound.getBoolean("HurtEntities"); + this.fallHurtAmount = nbttagcompound.getFloat("FallHurtAmount"); + this.fallHurtMax = nbttagcompound.getInt("FallHurtMax"); + } else if (this.id == Blocks.ANVIL) { + this.hurtEntities = true; + } + + if (nbttagcompound.hasKeyOfType("DropItem", 99)) { + this.dropItem = nbttagcompound.getBoolean("DropItem"); + } + + if (nbttagcompound.hasKeyOfType("TileEntityData", 10)) { + this.tileEntityData = nbttagcompound.getCompound("TileEntityData"); + } + + if (this.id.getMaterial() == Material.AIR) { + this.id = Blocks.SAND; + } + } + + public void a(boolean flag) { + this.hurtEntities = flag; + } + + public void a(CrashReportSystemDetails crashreportsystemdetails) { + super.a(crashreportsystemdetails); + crashreportsystemdetails.a("Immitating block ID", Integer.valueOf(Block.b(this.id))); + crashreportsystemdetails.a("Immitating block data", Integer.valueOf(this.data)); + } + + public Block f() { + return this.id; + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityGhast.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityGhast.java new file mode 100644 index 000000000..e32a8733c --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityGhast.java @@ -0,0 +1,263 @@ +package net.minecraft.server.v1_7_R1; + +// CraftBukkit start +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; +import org.bukkit.event.entity.EntityTargetEvent; +// CraftBukkit end + +public class EntityGhast extends EntityFlying implements IMonster { + + public int h; + public double i; + public double j; + public double bn; + private Entity target; + private int br; + public int bo; + public int bp; + private int explosionPower = 1; + + public EntityGhast(World world) { + super(world); + this.a(4.0F, 4.0F); + this.fireProof = true; + this.b = 5; + } + + public boolean damageEntity(DamageSource damagesource, float f) { + if (this.isInvulnerable()) { + return false; + } else if ("fireball".equals(damagesource.p()) && damagesource.getEntity() instanceof EntityHuman) { + super.damageEntity(damagesource, 1000.0F); + ((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.z); + return true; + } else { + return super.damageEntity(damagesource, f); + } + } + + protected void c() { + super.c(); + this.datawatcher.a(16, Byte.valueOf((byte) 0)); + } + + protected void aD() { + super.aD(); + this.getAttributeInstance(GenericAttributes.a).setValue(10.0D); + } + + protected void bq() { + if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL) { + this.die(); + } + + if (Vegetated) + { + double d0 = this.i - this.locX; + double d1 = this.j - this.locY; + double d2 = this.bn - this.locZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + this.motX += d0 / d3 * 0.1D; + this.motY += d1 / d3 * 0.1D; + this.motZ += d2 / d3 * 0.1D; + + double d5 = this.i - this.locX; + double d6 = this.bn - this.locZ; + + this.aN = this.yaw = -((float) Math.atan2(d5, d6)) * 180.0F / 3.1415927F; + + return; + } + + this.w(); + this.bo = this.bp; + double d0 = this.i - this.locX; + double d1 = this.j - this.locY; + double d2 = this.bn - this.locZ; + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d3 < 1.0D || d3 > 3600.0D) { + this.i = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.j = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); + this.bn = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F); + } + + if (this.h-- <= 0) { + this.h += this.random.nextInt(5) + 2; + d3 = (double) MathHelper.sqrt(d3); + if (this.a(this.i, this.j, this.bn, d3)) { + this.motX += d0 / d3 * 0.1D; + this.motY += d1 / d3 * 0.1D; + this.motZ += d2 / d3 * 0.1D; + } else { + this.i = this.locX; + this.j = this.locY; + this.bn = this.locZ; + } + } + + if (this.target != null && this.target.dead) { + // CraftBukkit start + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + if (event.getTarget() == null) { + this.target = null; + } else { + this.target = ((CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end + } + + if (this.target == null || this.br-- <= 0) { + // CraftBukkit start + Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D); + if (target != null) { + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); + this.world.getServer().getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + if (event.getTarget() == null) { + this.target = null; + } else { + this.target = ((CraftEntity) event.getTarget()).getHandle(); + } + } + } + // CraftBukkit end + + if (this.target != null) { + this.br = 20; + } + } + + double d4 = 64.0D; + + if (this.target != null && this.target.e((Entity) this) < d4 * d4) { + double d5 = this.target.locX - this.locX; + double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F)); + double d7 = this.target.locZ - this.locZ; + + this.aN = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; + if (this.o(this.target)) { + if (this.bp == 10) { + this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0); + } + + ++this.bp; + if (this.bp == 20) { + this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0); + EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7); + + // CraftBukkit - set bukkitYield when setting explosionpower + entitylargefireball.bukkitYield = entitylargefireball.yield = this.explosionPower; + double d8 = 4.0D; + Vec3D vec3d = this.j(1.0F); + + entitylargefireball.locX = this.locX + vec3d.c * d8; + entitylargefireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D; + entitylargefireball.locZ = this.locZ + vec3d.e * d8; + this.world.addEntity(entitylargefireball); + this.bp = -40; + } + } else if (this.bp > 0) { + --this.bp; + } + } else { + this.aN = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F; + if (this.bp > 0) { + --this.bp; + } + } + + if (!this.world.isStatic) { + byte b0 = this.datawatcher.getByte(16); + byte b1 = (byte) (this.bp > 10 ? 1 : 0); + + if (b0 != b1) { + this.datawatcher.watch(16, Byte.valueOf(b1)); + } + } + } + + private boolean a(double d0, double d1, double d2, double d3) { + double d4 = (this.i - this.locX) / d3; + double d5 = (this.j - this.locY) / d3; + double d6 = (this.bn - this.locZ) / d3; + AxisAlignedBB axisalignedbb = this.boundingBox.clone(); + + for (int i = 1; (double) i < d3; ++i) { + axisalignedbb.d(d4, d5, d6); + if (!this.world.getCubes(this, axisalignedbb).isEmpty()) { + return false; + } + } + + return true; + } + + protected String t() { + return "mob.ghast.moan"; + } + + protected String aT() { + return "mob.ghast.scream"; + } + + protected String aU() { + return "mob.ghast.death"; + } + + protected Item getLoot() { + return Items.SULPHUR; + } + + protected void dropDeathLoot(boolean flag, int i) { + // CraftBukkit start + java.util.List loot = new java.util.ArrayList(); + int j = this.random.nextInt(2) + this.random.nextInt(1 + i); + + int k; + + if (j > 0) { + loot.add(CraftItemStack.asNewCraftStack(Items.GHAST_TEAR, j)); + } + + j = this.random.nextInt(3) + this.random.nextInt(1 + i); + + if (j > 0) { + loot.add(CraftItemStack.asNewCraftStack(Items.SULPHUR, j)); + } + + org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callEntityDeathEvent(this, loot); + // CraftBukkit end + } + + protected float bf() { + return 10.0F; + } + + public boolean canSpawn() { + return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty != EnumDifficulty.PEACEFUL; + } + + public int bz() { + return 1; + } + + public void b(NBTTagCompound nbttagcompound) { + super.b(nbttagcompound); + nbttagcompound.setInt("ExplosionPower", this.explosionPower); + } + + public void a(NBTTagCompound nbttagcompound) { + super.a(nbttagcompound); + if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) { + this.explosionPower = nbttagcompound.getInt("ExplosionPower"); + } + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityHorse.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityHorse.java similarity index 78% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityHorse.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityHorse.java index 4aa1bf80c..652a1b077 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityHorse.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityHorse.java @@ -1,10 +1,10 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.Iterator; import java.util.List; // CraftBukkit start -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit end @@ -58,9 +58,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.loadChest(); } - protected void a() { - super.a(); - this.datawatcher.a(16, Integer.valueOf(0)); + protected void c() { + super.c(); + this.datawatcher.a(16, Integer.valueOf(0)); this.datawatcher.a(19, Byte.valueOf((byte) 0)); this.datawatcher.a(20, Integer.valueOf(0)); this.datawatcher.a(21, String.valueOf("")); @@ -69,7 +69,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { public void setType(int i) { this.datawatcher.watch(19, Byte.valueOf((byte) i)); - this.cJ(); + this.cN(); } public int getType() { @@ -78,14 +78,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { public void setVariant(int i) { this.datawatcher.watch(20, Integer.valueOf(i)); - this.cJ(); + this.cN(); } public int getVariant() { return this.datawatcher.getInt(20); } - public String getLocalizedName() { + public String getName() { if (this.hasCustomName()) { return this.getCustomName(); } else { @@ -111,16 +111,16 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - private boolean w(int i) { + private boolean x(int i) { return (this.datawatcher.getInt(16) & i) != 0; } private void b(int i, boolean flag) { int j = this.datawatcher.getInt(16); - + if (Vegetated) return; - + if (flag) { this.datawatcher.watch(16, Integer.valueOf(j | i)); } else { @@ -128,16 +128,16 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - public boolean bV() { + public boolean bZ() { return !this.isBaby(); } public boolean isTame() { - return this.w(2); + return this.x(2); } - public boolean ca() { - return this.bV(); + public boolean ce() { + return this.bZ(); } public String getOwnerName() { @@ -148,7 +148,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.datawatcher.watch(21, s); } - public float cc() { + public float cg() { int i = this.getAge(); return i >= 0 ? 1.0F : 0.5F + (float) (-24000 - i) / -24000.0F * 0.5F; @@ -156,13 +156,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { public void a(boolean flag) { if (flag) { - this.a(this.cc()); + this.a(this.cg()); } else { this.a(1.0F); } } - public boolean cd() { + public boolean ch() { return this.br; } @@ -174,47 +174,53 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.br = flag; } - public boolean bG() { - return !this.cy() && super.bG(); + public boolean bK() { + return !this.cC() && super.bK(); } protected void o(float f) { - if (f > 6.0F && this.cg()) { + if (f > 6.0F && this.ck()) { this.o(false); } } public boolean hasChest() { - return this.w(8); + return this.x(8); } - public int cf() { + public int cj() { return this.datawatcher.getInt(22); } - public int d(ItemStack itemstack) { - return itemstack == null ? 0 : (itemstack.id == Item.HORSE_ARMOR_IRON.id ? 1 : (itemstack.id == Item.HORSE_ARMOR_GOLD.id ? 2 : (itemstack.id == Item.HORSE_ARMOR_DIAMOND.id ? 3 : 0))); + private int e(ItemStack itemstack) { + if (itemstack == null) { + return 0; + } else { + Item item = itemstack.getItem(); + + return item == Items.HORSE_ARMOR_IRON ? 1 : (item == Items.HORSE_ARMOR_GOLD ? 2 : (item == Items.HORSE_ARMOR_DIAMOND ? 3 : 0)); + } } - public boolean cg() { - return this.w(32); + public boolean ck() { + return this.x(32); } - public boolean ch() { - return this.w(64); + public boolean cl() { + return this.x(64); } - public boolean ci() { - return this.w(16); + public boolean cm() { + return this.x(16); } - public boolean cj() { + public boolean cn() { return this.bH; } - public void r(int i) { - this.datawatcher.watch(22, Integer.valueOf(i)); - this.cJ(); + public void d(ItemStack itemstack) { + this.datawatcher.watch(22, Integer.valueOf(this.e(itemstack))); + this.cN(); } public void k(boolean flag) { @@ -241,7 +247,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.bs = i; } - public int t(int i) { + public int v(int i) { int j = MathHelper.a(this.getTemper() + i, 0, this.getMaxDomestication()); this.setTemper(j); @@ -254,15 +260,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return this.passenger != null && this.passenger.equals(entity) ? false : super.damageEntity(damagesource, f); } - public int aQ() { - return by[this.cf()]; + public int aV() { + return by[this.cj()]; } - public boolean M() { + public boolean S() { return this.passenger == null; } - public boolean cl() { + public boolean cp() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locZ); @@ -270,15 +276,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return true; } - public void cm() { + public void cq() { if (!this.world.isStatic && this.hasChest()) { - this.b(Block.CHEST.id, 1); + this.a(Item.getItemOf(Blocks.CHEST), 1); this.setHasChest(false); } } - private void cF() { - this.cM(); + private void cJ() { + this.cQ(); this.world.makeSound(this, "eating", 1.0F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F); } @@ -312,17 +318,17 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { // CraftBukkit end } - int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ)); + Block block = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.2D - (double) this.lastYaw), MathHelper.floor(this.locZ)); - if (j > 0) { - StepSound stepsound = Block.byId[j].stepSound; + if (block.getMaterial() != Material.AIR) { + StepSound stepsound = block.stepSound; this.world.makeSound(this, stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); } } } - private int cG() { + private int cK() { int i = this.getType(); return this.hasChest() /* && (i == 1 || i == 2) */ ? 17 : 2; // CraftBukkit - Remove type check @@ -331,8 +337,8 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { public void loadChest() { // CraftBukkit - private -> public InventoryHorseChest inventoryhorsechest = this.inventoryChest; - this.inventoryChest = new InventoryHorseChest("HorseChest", this.cG(), this); // CraftBukkit - add this horse - this.inventoryChest.a(this.getLocalizedName()); + this.inventoryChest = new InventoryHorseChest("HorseChest", this.cK(), this); // CraftBukkit - add this horse + this.inventoryChest.a(this.getName()); if (inventoryhorsechest != null) { inventoryhorsechest.b(this); int i = Math.min(inventoryhorsechest.getSize(), this.inventoryChest.getSize()); @@ -349,36 +355,38 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } this.inventoryChest.a(this); - this.cI(); + this.cM(); } - private void cI() { + private void cM() { if (!this.world.isStatic) { this.n(this.inventoryChest.getItem(0) != null); - if (this.cv()) { - this.r(this.d(this.inventoryChest.getItem(1))); + if (this.cz()) { + this.d(this.inventoryChest.getItem(1)); } } } public void a(InventorySubcontainer inventorysubcontainer) { - int i = this.cf(); - boolean flag = this.co(); + int i = this.cj(); + boolean flag = this.cs(); - this.cI(); + this.cM(); if (this.ticksLived > 20) { - if (i == 0 && i != this.cf()) { + if (i == 0 && i != this.cj()) { + this.makeSound("mob.horse.armor", 0.5F, 1.0F); + } else if (i != this.cj()) { this.makeSound("mob.horse.armor", 0.5F, 1.0F); } - if (!flag && this.co()) { + if (!flag && this.cs()) { this.makeSound("mob.horse.leather", 0.5F, 1.0F); } } } public boolean canSpawn() { - this.cl(); + this.cp(); return super.canSpawn(); } @@ -405,24 +413,24 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return this.getAttributeInstance(attributeJumpStrength).getValue(); } - protected String aP() { - this.cM(); + protected String aU() { + this.cQ(); int i = this.getType(); return i == 3 ? "mob.horse.zombie.death" : (i == 4 ? "mob.horse.skeleton.death" : (i != 1 && i != 2 ? "mob.horse.death" : "mob.horse.donkey.death")); } - protected int getLootId() { + protected Item getLoot() { boolean flag = this.random.nextInt(4) == 0; int i = this.getType(); - return i == 4 ? Item.BONE.id : (i == 3 ? (flag ? 0 : Item.ROTTEN_FLESH.id) : Item.LEATHER.id); + return i == 4 ? Items.BONE : (i == 3 ? (flag ? Item.d(0) : Items.ROTTEN_FLESH) : Items.LEATHER); } - protected String aO() { - this.cM(); + protected String aT() { + this.cQ(); if (this.random.nextInt(3) == 0) { - this.cO(); + this.cS(); } int i = this.getType(); @@ -430,14 +438,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return i == 3 ? "mob.horse.zombie.hit" : (i == 4 ? "mob.horse.skeleton.hit" : (i != 1 && i != 2 ? "mob.horse.hit" : "mob.horse.donkey.hit")); } - public boolean co() { - return this.w(4); + public boolean cs() { + return this.x(4); } - protected String r() { - this.cM(); - if (this.random.nextInt(10) == 0 && !this.bc()) { - this.cO(); + protected String t() { + this.cQ(); + if (this.random.nextInt(10) == 0 && !this.bh()) { + this.cS(); } int i = this.getType(); @@ -445,50 +453,50 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return i == 3 ? "mob.horse.zombie.idle" : (i == 4 ? "mob.horse.skeleton.idle" : (i != 1 && i != 2 ? "mob.horse.idle" : "mob.horse.donkey.idle")); } - protected String cp() { - this.cM(); - this.cO(); + protected String ct() { + this.cQ(); + this.cS(); int i = this.getType(); return i != 3 && i != 4 ? (i != 1 && i != 2 ? "mob.horse.angry" : "mob.horse.donkey.angry") : null; } - protected void a(int i, int j, int k, int l) { - StepSound stepsound = Block.byId[l].stepSound; + protected void a(int i, int j, int k, Block block) { + StepSound stepsound = block.stepSound; - if (this.world.getTypeId(i, j + 1, k) == Block.SNOW.id) { - stepsound = Block.SNOW.stepSound; + if (this.world.getType(i, j + 1, k) == Blocks.SNOW) { + stepsound = Blocks.SNOW.stepSound; } - if (!Block.byId[l].material.isLiquid()) { - int i1 = this.getType(); + if (!block.getMaterial().isLiquid()) { + int l = this.getType(); - if (this.passenger != null && i1 != 1 && i1 != 2) { + if (this.passenger != null && l != 1 && l != 2) { ++this.bP; if (this.bP > 5 && this.bP % 3 == 0) { this.makeSound("mob.horse.gallop", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); - if (i1 == 0 && this.random.nextInt(10) == 0) { + if (l == 0 && this.random.nextInt(10) == 0) { this.makeSound("mob.horse.breathe", stepsound.getVolume1() * 0.6F, stepsound.getVolume2()); } } else if (this.bP <= 5) { this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } - } else if (stepsound == Block.h) { - this.makeSound("mob.horse.soft", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); - } else { + } else if (stepsound == Block.f) { this.makeSound("mob.horse.wood", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); + } else { + this.makeSound("mob.horse.soft", stepsound.getVolume1() * 0.15F, stepsound.getVolume2()); } } } - protected void az() { - super.az(); - this.aX().b(attributeJumpStrength); + protected void aD() { + super.aD(); + this.bc().b(attributeJumpStrength); this.getAttributeInstance(GenericAttributes.a).setValue(53.0D); this.getAttributeInstance(GenericAttributes.d).setValue(0.22499999403953552D); } - public int bv() { + public int bz() { return 6; } @@ -496,21 +504,21 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100 } - protected float ba() { + protected float bf() { return 0.8F; } - public int o() { + public int q() { return 400; } - private void cJ() { + private void cN() { this.bQ = null; } - public void f(EntityHuman entityhuman) { + public void g(EntityHuman entityhuman) { if (!this.world.isStatic && (this.passenger == null || this.passenger == entityhuman) && this.isTame()) { - this.inventoryChest.a(this.getLocalizedName()); + this.inventoryChest.a(this.getName()); entityhuman.openHorseInventory(this, this.inventoryChest); } } @@ -518,80 +526,80 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { public boolean a(EntityHuman entityhuman) { ItemStack itemstack = entityhuman.inventory.getItemInHand(); - if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id) { + if (itemstack != null && itemstack.getItem() == Items.MONSTER_EGG) { return super.a(entityhuman); - } else if (!this.isTame() && this.cy()) { + } else if (!this.isTame() && this.cC()) { return false; - } else if (this.isTame() && this.bV() && entityhuman.isSneaking()) { - this.f(entityhuman); + } else if (this.isTame() && this.bZ() && entityhuman.isSneaking()) { + this.g(entityhuman); return true; - } else if (this.ca() && this.passenger != null) { + } else if (this.ce() && this.passenger != null) { return super.a(entityhuman); } else { if (itemstack != null) { boolean flag = false; - if (this.cv()) { + if (this.cz()) { byte b0 = -1; - if (itemstack.id == Item.HORSE_ARMOR_IRON.id) { + if (itemstack.getItem() == Items.HORSE_ARMOR_IRON) { b0 = 1; - } else if (itemstack.id == Item.HORSE_ARMOR_GOLD.id) { + } else if (itemstack.getItem() == Items.HORSE_ARMOR_GOLD) { b0 = 2; - } else if (itemstack.id == Item.HORSE_ARMOR_DIAMOND.id) { + } else if (itemstack.getItem() == Items.HORSE_ARMOR_DIAMOND) { b0 = 3; } if (b0 >= 0) { if (!this.isTame()) { - this.cD(); + this.cH(); return true; } - this.f(entityhuman); + this.g(entityhuman); return true; } } - if (!flag && !this.cy()) { + if (!flag && !this.cC()) { float f = 0.0F; short short1 = 0; byte b1 = 0; - if (itemstack.id == Item.WHEAT.id) { + if (itemstack.getItem() == Items.WHEAT) { f = 2.0F; short1 = 60; b1 = 3; - } else if (itemstack.id == Item.SUGAR.id) { + } else if (itemstack.getItem() == Items.SUGAR) { f = 1.0F; short1 = 30; b1 = 3; - } else if (itemstack.id == Item.BREAD.id) { + } else if (itemstack.getItem() == Items.BREAD) { f = 7.0F; short1 = 180; b1 = 3; - } else if (itemstack.id == Block.HAY_BLOCK.id) { + } else if (Block.a(itemstack.getItem()) == Blocks.HAY_BLOCK) { f = 20.0F; short1 = 180; - } else if (itemstack.id == Item.APPLE.id) { + } else if (itemstack.getItem() == Items.APPLE) { f = 3.0F; short1 = 60; b1 = 3; - } else if (itemstack.id == Item.CARROT_GOLDEN.id) { + } else if (itemstack.getItem() == Items.CARROT_GOLDEN) { f = 4.0F; short1 = 60; b1 = 5; if (this.isTame() && this.getAge() == 0) { flag = true; - this.bX(); + this.f(entityhuman); } - } else if (itemstack.id == Item.GOLDEN_APPLE.id) { + } else if (itemstack.getItem() == Items.GOLDEN_APPLE) { f = 10.0F; short1 = 240; b1 = 10; if (this.isTame() && this.getAge() == 0) { flag = true; - this.bX(); + this.f(entityhuman); } } @@ -600,18 +608,18 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { flag = true; } - if (!this.bV() && short1 > 0) { + if (!this.bZ() && short1 > 0) { this.a(short1); flag = true; } if (b1 > 0 && (flag || !this.isTame()) && b1 < this.getMaxDomestication()) { flag = true; - this.t(b1); + this.v(b1); } if (flag) { - this.cF(); + this.cJ(); } } @@ -620,19 +628,19 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return true; } - this.cD(); + this.cH(); return true; } - if (!flag && this.cw() && !this.hasChest() && itemstack.id == Block.CHEST.id) { + if (!flag && this.cA() && !this.hasChest() && itemstack.getItem() == Item.getItemOf(Blocks.CHEST)) { this.setHasChest(true); this.makeSound("mob.chickenplop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); flag = true; this.loadChest(); } - if (!flag && this.ca() && !this.co() && itemstack.id == Item.SADDLE.id) { - this.f(entityhuman); + if (!flag && this.ce() && !this.cs() && itemstack.getItem() == Items.SADDLE) { + this.g(entityhuman); return true; } @@ -645,11 +653,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - if (this.ca() && this.passenger == null) { + if (this.ce() && this.passenger == null) { if (itemstack != null && itemstack.a(entityhuman, (EntityLiving) this)) { return true; } else { - this.h(entityhuman); + this.i(entityhuman); return true; } } else { @@ -658,7 +666,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - private void h(EntityHuman entityhuman) { + private void i(EntityHuman entityhuman) { entityhuman.yaw = this.yaw; entityhuman.pitch = this.pitch; this.o(false); @@ -668,66 +676,66 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - public boolean cv() { + public boolean cz() { return this.getType() == 0; } - public boolean cw() { + public boolean cA() { int i = this.getType(); return i == 2 || i == 1; } - protected boolean bc() { - return this.passenger != null && this.co() ? true : this.cg() || this.ch(); + protected boolean bh() { + return this.passenger != null && this.cs() ? true : this.ck() || this.cl(); } - public boolean cy() { + public boolean cC() { int i = this.getType(); return i == 3 || i == 4; } - public boolean cz() { - return this.cy() || this.getType() == 2; + public boolean cD() { + return this.cC() || this.getType() == 2; } public boolean c(ItemStack itemstack) { return false; } - private void cL() { + private void cP() { this.bp = 1; } public void die(DamageSource damagesource) { super.die(damagesource); if (!this.world.isStatic) { - this.cE(); + this.cI(); } } - public void c() { + public void e() { if (this.random.nextInt(200) == 0) { - this.cL(); + this.cP(); } - super.c(); + super.e(); if (!this.world.isStatic) { if (this.random.nextInt(900) == 0 && this.deathTicks == 0) { this.heal(1.0F); } - if (!this.cg() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ)) == Block.GRASS.id) { + if (!this.ck() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ)) == Blocks.GRASS) { this.o(true); } - if (this.cg() && ++this.bD > 50) { + if (this.ck() && ++this.bD > 50) { this.bD = 0; this.o(false); } - if (this.ci() && !this.bV() && !this.cg()) { + if (this.cm() && !this.bZ() && !this.ck()) { EntityHorse entityhorse = this.a(this, 16.0D); if (entityhorse != null && this.e(entityhorse) > 4.0D) { @@ -739,11 +747,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - public void l_() { - super.l_(); + public void h() { + super.h(); if (this.world.isStatic && this.datawatcher.a()) { this.datawatcher.e(); - this.cJ(); + this.cN(); } if (this.bE > 0 && ++this.bE > 30) { @@ -768,7 +776,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } this.bK = this.bJ; - if (this.cg()) { + if (this.ck()) { this.bJ += (1.0F - this.bJ) * 0.4F + 0.05F; if (this.bJ > 1.0F) { this.bJ = 1.0F; @@ -781,7 +789,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } this.bM = this.bL; - if (this.ch()) { + if (this.cl()) { this.bK = this.bJ = 0.0F; this.bL += (1.0F - this.bL) * 0.4F + 0.05F; if (this.bL > 1.0F) { @@ -796,7 +804,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } this.bO = this.bN; - if (this.w(128)) { + if (this.x(128)) { this.bN += (1.0F - this.bN) * 0.7F + 0.05F; if (this.bN > 1.0F) { this.bN = 1.0F; @@ -809,15 +817,15 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - private void cM() { + private void cQ() { if (!this.world.isStatic) { this.bE = 1; this.b(128, true); } } - private boolean cN() { - return this.passenger == null && this.vehicle == null && this.isTame() && this.bV() && !this.cz() && this.getHealth() >= this.getMaxHealth(); + private boolean cR() { + return this.passenger == null && this.vehicle == null && this.isTame() && this.bZ() && !this.cD() && this.getHealth() >= this.getMaxHealth(); } public void e(boolean flag) { @@ -836,25 +844,25 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.b(64, flag); } - private void cO() { + private void cS() { if (!this.world.isStatic) { this.bF = 1; this.p(true); } } - public void cD() { - this.cO(); - String s = this.cp(); + public void cH() { + this.cS(); + String s = this.ct(); if (s != null) { - this.makeSound(s, this.ba(), this.bb()); + this.makeSound(s, this.bf(), this.bg()); } } - public void cE() { + public void cI() { this.a(this, this.inventoryChest); - this.cm(); + this.cq(); } private void a(Entity entity, InventoryHorseChest inventoryhorsechest) { @@ -869,14 +877,14 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } } - public boolean g(EntityHuman entityhuman) { + public boolean h(EntityHuman entityhuman) { this.setOwnerName(entityhuman.getName()); this.setTame(true); return true; } public void e(float f, float f1) { - if (this.passenger != null && this.co()) { + if (this.passenger != null && this.passenger instanceof EntityLiving && this.cs()) { // CraftBukkit - Check type of passenger this.lastYaw = this.yaw = this.passenger.yaw; this.pitch = this.passenger.pitch * 0.5F; this.b(this.yaw, this.pitch); @@ -888,19 +896,19 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.bP = 0; } - if (this.onGround && this.bt == 0.0F && this.ch() && !this.bI) { + if (this.onGround && this.bt == 0.0F && this.cl() && !this.bI) { f = 0.0F; f1 = 0.0F; } - if (this.bt > 0.0F && !this.cd() && this.onGround) { + if (this.bt > 0.0F && !this.ch() && this.onGround) { this.motY = this.getJumpStrength() * (double) this.bt; if (this.hasEffect(MobEffectList.JUMP)) { this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F); } this.j(true); - this.an = true; + this.am = true; if (f1 > 0.0F) { float f2 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F); float f3 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F); @@ -913,8 +921,8 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.bt = 0.0F; } - this.Y = 1.0F; - this.aR = this.bg() * 0.1F; + this.X = 1.0F; + this.aR = this.bl() * 0.1F; if (!this.world.isStatic) { this.i((float) this.getAttributeInstance(GenericAttributes.d).getValue()); super.e(f, f1); @@ -937,7 +945,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.aG += (f4 - this.aG) * 0.4F; this.aH += this.aG; } else { - this.Y = 0.5F; + this.X = 0.5F; this.aR = 0.02F; super.e(f, f1); } @@ -945,10 +953,10 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.setBoolean("EatingHaystack", this.cg()); + nbttagcompound.setBoolean("EatingHaystack", this.ck()); nbttagcompound.setBoolean("ChestedHorse", this.hasChest()); - nbttagcompound.setBoolean("HasReproduced", this.cj()); - nbttagcompound.setBoolean("Bred", this.ci()); + nbttagcompound.setBoolean("HasReproduced", this.cn()); + nbttagcompound.setBoolean("Bred", this.cm()); nbttagcompound.setInt("Type", this.getType()); nbttagcompound.setInt("Variant", this.getVariant()); nbttagcompound.setInt("Temper", this.getTemper()); @@ -974,11 +982,11 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } if (this.inventoryChest.getItem(1) != null) { - nbttagcompound.set("ArmorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound("ArmorItem"))); + nbttagcompound.set("ArmorItem", this.inventoryChest.getItem(1).save(new NBTTagCompound())); } if (this.inventoryChest.getItem(0) != null) { - nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound("SaddleItem"))); + nbttagcompound.set("SaddleItem", this.inventoryChest.getItem(0).save(new NBTTagCompound())); } } @@ -992,7 +1000,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.setVariant(nbttagcompound.getInt("Variant")); this.setTemper(nbttagcompound.getInt("Temper")); this.setTame(nbttagcompound.getBoolean("Tame")); - if (nbttagcompound.hasKey("OwnerName")) { + if (nbttagcompound.hasKeyOfType("OwnerName", 8)) { this.setOwnerName(nbttagcompound.getString("OwnerName")); } // CraftBukkit start @@ -1000,19 +1008,19 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { this.maxDomestication = nbttagcompound.getInt("Bukkit.MaxDomestication"); } // CraftBukkit end - AttributeInstance attributeinstance = this.aX().a("Speed"); + AttributeInstance attributeinstance = this.bc().a("Speed"); if (attributeinstance != null) { this.getAttributeInstance(GenericAttributes.d).setValue(attributeinstance.b() * 0.25D); } if (this.hasChest()) { - NBTTagList nbttaglist = nbttagcompound.getList("Items"); + NBTTagList nbttaglist = nbttagcompound.getList("Items", 10); this.loadChest(); for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + NBTTagCompound nbttagcompound1 = nbttaglist.get(i); int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 2 && j < this.inventoryChest.getSize()) { @@ -1023,23 +1031,23 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { ItemStack itemstack; - if (nbttagcompound.hasKey("ArmorItem")) { + if (nbttagcompound.hasKeyOfType("ArmorItem", 10)) { itemstack = ItemStack.createStack(nbttagcompound.getCompound("ArmorItem")); - if (itemstack != null && v(itemstack.id)) { + if (itemstack != null && a(itemstack.getItem())) { this.inventoryChest.setItem(1, itemstack); } } - if (nbttagcompound.hasKey("SaddleItem")) { + if (nbttagcompound.hasKeyOfType("SaddleItem", 10)) { itemstack = ItemStack.createStack(nbttagcompound.getCompound("SaddleItem")); - if (itemstack != null && itemstack.id == Item.SADDLE.id) { + if (itemstack != null && itemstack.getItem() == Items.SADDLE) { this.inventoryChest.setItem(0, itemstack); } } else if (nbttagcompound.getBoolean("Saddle")) { - this.inventoryChest.setItem(0, new ItemStack(Item.SADDLE)); + this.inventoryChest.setItem(0, new ItemStack(Items.SADDLE)); } - this.cI(); + this.cM(); } public boolean mate(EntityAnimal entityanimal) { @@ -1050,7 +1058,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } else { EntityHorse entityhorse = (EntityHorse) entityanimal; - if (this.cN() && entityhorse.cN()) { + if (this.cR() && entityhorse.cR()) { int i = this.getType(); int j = entityhorse.getType(); @@ -1088,9 +1096,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { int j1 = this.random.nextInt(5); - if (j1 < 4) { + if (j1 < 2) { i1 |= this.getVariant() & '\uff00'; - } else if (j1 < 8) { + } else if (j1 < 4) { i1 |= entityhorse.getVariant() & '\uff00'; } else { i1 |= this.random.nextInt(5) << 8 & '\uff00'; @@ -1100,13 +1108,13 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } entityhorse1.setType(k); - double d0 = this.getAttributeInstance(GenericAttributes.a).b() + entityageable.getAttributeInstance(GenericAttributes.a).b() + (double) this.cP(); + double d0 = this.getAttributeInstance(GenericAttributes.a).b() + entityageable.getAttributeInstance(GenericAttributes.a).b() + (double) this.cT(); entityhorse1.getAttributeInstance(GenericAttributes.a).setValue(d0 / 3.0D); - double d1 = this.getAttributeInstance(attributeJumpStrength).b() + entityageable.getAttributeInstance(attributeJumpStrength).b() + this.cQ(); + double d1 = this.getAttributeInstance(attributeJumpStrength).b() + entityageable.getAttributeInstance(attributeJumpStrength).b() + this.cU(); entityhorse1.getAttributeInstance(attributeJumpStrength).setValue(d1 / 3.0D); - double d2 = this.getAttributeInstance(GenericAttributes.d).b() + entityageable.getAttributeInstance(GenericAttributes.d).b() + this.cR(); + double d2 = this.getAttributeInstance(GenericAttributes.d).b() + entityageable.getAttributeInstance(GenericAttributes.d).b() + this.cV(); entityhorse1.getAttributeInstance(GenericAttributes.d).setValue(d2 / 3.0D); return entityhorse1; @@ -1142,9 +1150,9 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } if (j != 4 && j != 3) { - this.getAttributeInstance(GenericAttributes.a).setValue((double) this.cP()); + this.getAttributeInstance(GenericAttributes.a).setValue((double) this.cT()); if (j == 0) { - this.getAttributeInstance(GenericAttributes.d).setValue(this.cR()); + this.getAttributeInstance(GenericAttributes.d).setValue(this.cV()); } else { this.getAttributeInstance(GenericAttributes.d).setValue(0.17499999701976776D); } @@ -1154,7 +1162,7 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { } if (j != 2 && j != 1) { - this.getAttributeInstance(attributeJumpStrength).setValue(this.cQ()); + this.getAttributeInstance(attributeJumpStrength).setValue(this.cU()); } else { this.getAttributeInstance(attributeJumpStrength).setValue(0.5D); } @@ -1163,12 +1171,12 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { return (GroupDataEntity) object; } - protected boolean bf() { + protected boolean bk() { return true; } - public void u(int i) { - if (this.co()) { + public void w(int i) { + if (this.cs()) { // CraftBukkit start - fire HorseJumpEvent, use event power if (i < 0) { i = 0; @@ -1181,48 +1189,48 @@ public class EntityHorse extends EntityAnimal implements IInventoryListener { power = 0.4F + 0.4F * (float) i / 90.0F; } - org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.callHorseJumpEvent(this, power); + org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callHorseJumpEvent(this, power); if (!event.isCancelled()) { this.bI = true; - this.cO(); + this.cS(); this.bt = event.getPower(); } // CraftBukkit end } } - public void W() { - super.W(); + public void ac() { + super.ac(); if (this.bM > 0.0F) { float f = MathHelper.sin(this.aN * 3.1415927F / 180.0F); float f1 = MathHelper.cos(this.aN * 3.1415927F / 180.0F); float f2 = 0.7F * this.bM; float f3 = 0.15F * this.bM; - this.passenger.setPosition(this.locX + (double) (f2 * f), this.locY + this.Y() + this.passenger.X() + (double) f3, this.locZ - (double) (f2 * f1)); + this.passenger.setPosition(this.locX + (double) (f2 * f), this.locY + this.ae() + this.passenger.ad() + (double) f3, this.locZ - (double) (f2 * f1)); if (this.passenger instanceof EntityLiving) { ((EntityLiving) this.passenger).aN = this.aN; } } } - private float cP() { + private float cT() { return 15.0F + (float) this.random.nextInt(8) + (float) this.random.nextInt(9); } - private double cQ() { + private double cU() { return 0.4000000059604645D + this.random.nextDouble() * 0.2D + this.random.nextDouble() * 0.2D + this.random.nextDouble() * 0.2D; } - private double cR() { + private double cV() { return (0.44999998807907104D + this.random.nextDouble() * 0.3D + this.random.nextDouble() * 0.3D + this.random.nextDouble() * 0.3D) * 0.25D; } - public static boolean v(int i) { - return i == Item.HORSE_ARMOR_IRON.id || i == Item.HORSE_ARMOR_GOLD.id || i == Item.HORSE_ARMOR_DIAMOND.id; + public static boolean a(Item item) { + return item == Items.HORSE_ARMOR_IRON || item == Items.HORSE_ARMOR_GOLD || item == Items.HORSE_ARMOR_DIAMOND; } - public boolean e() { + public boolean h_() { return false; } -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityHuman.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityHuman.java similarity index 76% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityHuman.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityHuman.java index 8c9e258e2..e74592445 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityHuman.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityHuman.java @@ -1,76 +1,17 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.Collection; import java.util.Iterator; import java.util.List; +import java.util.UUID; -import net.minecraft.server.v1_6_R3.AchievementList; -import net.minecraft.server.v1_6_R3.AttributeInstance; -import net.minecraft.server.v1_6_R3.AxisAlignedBB; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.BlockBed; -import net.minecraft.server.v1_6_R3.ChunkCoordinates; -import net.minecraft.server.v1_6_R3.Container; -import net.minecraft.server.v1_6_R3.ContainerPlayer; -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.EnchantmentManager; -import net.minecraft.server.v1_6_R3.EnchantmentThorns; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityArrow; -import net.minecraft.server.v1_6_R3.EntityBoat; -import net.minecraft.server.v1_6_R3.EntityComplexPart; -import net.minecraft.server.v1_6_R3.EntityFishingHook; -import net.minecraft.server.v1_6_R3.EntityHorse; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityItem; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.EntityMinecartAbstract; -import net.minecraft.server.v1_6_R3.EntityMinecartHopper; -import net.minecraft.server.v1_6_R3.EntityMonster; -import net.minecraft.server.v1_6_R3.EntityPig; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EnumAnimation; -import net.minecraft.server.v1_6_R3.EnumBedResult; -import net.minecraft.server.v1_6_R3.EnumGamemode; -import net.minecraft.server.v1_6_R3.FoodMetaData; -import net.minecraft.server.v1_6_R3.GenericAttributes; -import net.minecraft.server.v1_6_R3.IChunkProvider; -import net.minecraft.server.v1_6_R3.ICommandListener; -import net.minecraft.server.v1_6_R3.IComplex; -import net.minecraft.server.v1_6_R3.IInventory; -import net.minecraft.server.v1_6_R3.IMerchant; -import net.minecraft.server.v1_6_R3.IMonster; -import net.minecraft.server.v1_6_R3.IScoreboardCriteria; -import net.minecraft.server.v1_6_R3.InventoryEnderChest; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.Material; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.MobEffectList; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.NBTTagList; -import net.minecraft.server.v1_6_R3.Packet103SetSlot; -import net.minecraft.server.v1_6_R3.PlayerAbilities; -import net.minecraft.server.v1_6_R3.PlayerInventory; -import net.minecraft.server.v1_6_R3.Scoreboard; -import net.minecraft.server.v1_6_R3.ScoreboardScore; -import net.minecraft.server.v1_6_R3.ScoreboardTeam; -import net.minecraft.server.v1_6_R3.ScoreboardTeamBase; -import net.minecraft.server.v1_6_R3.Statistic; -import net.minecraft.server.v1_6_R3.StatisticList; -import net.minecraft.server.v1_6_R3.TileEntity; -import net.minecraft.server.v1_6_R3.TileEntityBeacon; -import net.minecraft.server.v1_6_R3.TileEntityBrewingStand; -import net.minecraft.server.v1_6_R3.TileEntityDispenser; -import net.minecraft.server.v1_6_R3.TileEntityFurnace; -import net.minecraft.server.v1_6_R3.TileEntityHopper; -import net.minecraft.server.v1_6_R3.Vec3D; -import net.minecraft.server.v1_6_R3.World; +import net.minecraft.util.com.google.common.base.Charsets; +import net.minecraft.util.com.mojang.authlib.GameProfile; // CraftBukkit start -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHumanEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftItem; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftItem; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityCombustByEntityEvent; import org.bukkit.event.player.PlayerBedEnterEvent; @@ -85,18 +26,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen private InventoryEnderChest enderChest = new InventoryEnderChest(); public Container defaultContainer; public Container activeContainer; - protected FoodMetaData foodData = new FoodMetaData(); + protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor protected int br; public float bs; public float bt; - protected final String name; - public int bv; + public int bu; + public double bv; public double bw; public double bx; public double by; public double bz; public double bA; - public double bB; // CraftBukkit start public boolean sleeping; // protected -> public public boolean fauxSleeping; @@ -108,10 +48,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } // CraftBukkit end - public ChunkCoordinates bD; + public ChunkCoordinates bC; public int sleepTicks; // CraftBukkit - private -> public + public float bD; public float bE; - public float bF; private ChunkCoordinates c; private boolean d; private ChunkCoordinates e; @@ -122,14 +62,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public float exp; private ItemStack f; private int g; - protected float bK = 0.1F; - protected float bL = 0.02F; + protected float bJ = 0.1F; + protected float bK = 0.02F; private int h; + private final GameProfile i; public EntityFishingHook hookedFish; - public EntityHuman(World world, String s) { + public EntityHuman(World world, GameProfile gameprofile) { super(world); - this.name = s; + this.uniqueID = a(gameprofile); + this.i = gameprofile; this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic, this); this.activeContainer = this.defaultContainer; this.height = 1.62F; @@ -140,31 +82,31 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.maxFireTicks = 20; } - protected void az() { - super.az(); - this.aX().b(GenericAttributes.e).setValue(1.0D); + protected void aD() { + super.aD(); + this.bc().b(GenericAttributes.e).setValue(1.0D); } - protected void a() { - super.a(); + protected void c() { + super.c(); this.datawatcher.a(16, Byte.valueOf((byte) 0)); this.datawatcher.a(17, Float.valueOf(0.0F)); this.datawatcher.a(18, Integer.valueOf(0)); } - public boolean br() { + public boolean bw() { return this.f != null; } - public void bt() { + public void by() { if (this.f != null) { this.f.b(this.world, this, this.g); } - this.bu(); + this.bz(); } - public void bu() { + public void bz() { this.f = null; this.g = 0; if (!this.world.isStatic) { @@ -173,10 +115,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public boolean isBlocking() { - return this.br() && Item.byId[this.f.id].c_(this.f) == EnumAnimation.BLOCK; + return this.bw() && this.f.getItem().d(this.f) == EnumAnimation.BLOCK; } - public void l_() { + public void h() { if (this.f != null) { ItemStack itemstack = this.inventory.getItemInHand(); @@ -186,15 +128,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } if (--this.g == 0 && !this.world.isStatic) { - this.n(); + this.p(); } } else { - this.bu(); + this.bz(); } } - if (this.bv > 0) { - --this.bv; + if (this.bu > 0) { + --this.bu; } if (this.isSleeping()) { @@ -204,7 +146,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } if (!this.world.isStatic) { - if (!this.h()) { + if (!this.j()) { this.a(true, true, false); } else if (this.world.v()) { this.a(false, true, true); @@ -217,7 +159,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - super.l_(); + super.h(); if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) { this.closeInventory(); this.activeContainer = this.defaultContainer; @@ -227,56 +169,64 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.extinguish(); } + this.bv = this.by; this.bw = this.bz; this.bx = this.bA; - this.by = this.bB; - double d0 = this.locX - this.bz; - double d1 = this.locY - this.bA; - double d2 = this.locZ - this.bB; + double d0 = this.locX - this.by; + double d1 = this.locY - this.bz; + double d2 = this.locZ - this.bA; double d3 = 10.0D; if (d0 > d3) { - this.bw = this.bz = this.locX; + this.bv = this.by = this.locX; } if (d2 > d3) { - this.by = this.bB = this.locZ; + this.bx = this.bA = this.locZ; } if (d1 > d3) { - this.bx = this.bA = this.locY; + this.bw = this.bz = this.locY; } if (d0 < -d3) { - this.bw = this.bz = this.locX; + this.bv = this.by = this.locX; } if (d2 < -d3) { - this.by = this.bB = this.locZ; + this.bx = this.bA = this.locZ; } if (d1 < -d3) { - this.bx = this.bA = this.locY; + this.bw = this.bz = this.locY; } - this.bz += d0 * 0.25D; - this.bB += d2 * 0.25D; - this.bA += d1 * 0.25D; - this.a(StatisticList.k, 1); + this.by += d0 * 0.25D; + this.bA += d2 * 0.25D; + this.bz += d1 * 0.25D; if (this.vehicle == null) { this.e = null; } if (!this.world.isStatic) { this.foodData.a(this); + this.a(StatisticList.g, 1); } } - public int z() { + public int D() { return this.abilities.isInvulnerable ? 0 : 80; } - public int ac() { + protected String H() { + return "game.player.swim"; + } + + protected String O() { + return "game.player.swim.splash"; + } + + public int ai() { return 10; } @@ -300,14 +250,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen vec3d1.a(-this.pitch * 3.1415927F / 180.0F); vec3d1.b(-this.yaw * 3.1415927F / 180.0F); vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); - this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e); + String s = "iconcrack_" + Item.b(itemstack.getItem()); + + if (itemstack.usesData()) { + s = s + "_" + itemstack.getData(); + } + + this.world.addParticle(s, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e); } this.makeSound("random.eat", 0.5F + 0.5F * (float) this.random.nextInt(2), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } } - protected void n() { + protected void p() { if (this.f != null) { this.c(this.f, 16); int i = this.f.count; @@ -320,7 +276,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (event.isCancelled()) { // Update client if (this instanceof EntityPlayer) { - ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); } return; } @@ -331,7 +287,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen // Update client if (this instanceof EntityPlayer) { - ((EntityPlayer) this).playerConnection.sendPacket(new Packet103SetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); + ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutSetSlot((byte) 0, activeContainer.a((IInventory) this.inventory, this.inventory.itemInHandIndex).index, this.f)); } return; } @@ -346,11 +302,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - this.bu(); + this.bz(); } } - protected boolean bc() { + protected boolean bh() { return this.getHealth() <= 0.0F || this.isSleeping(); } @@ -367,8 +323,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void setPassengerOf(Entity entity) { // CraftBukkit end if (this.vehicle != null && entity == null) { - Entity originalVehicle = this.vehicle; - /* + // CraftBukkit start - use parent method instead to correctly fire VehicleExitEvent + Entity originalVehicle = this.vehicle; + // First statement moved down, second statement handled in parent method. + /* if (!this.world.isStatic) { this.l(this.vehicle); } @@ -380,16 +338,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.vehicle = null; */ super.setPassengerOf(entity); - if (!this.world.isStatic && this.vehicle == null) { - this.l(originalVehicle); + this.l(originalVehicle); } + // CraftBukkit end } else { super.setPassengerOf(entity); // CraftBukkit - call new parent } } - public void V() { + public void ab() { if (!this.world.isStatic && this.isSneaking()) { this.mount((Entity) null); this.setSneaking(false); @@ -400,10 +358,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen float f = this.yaw; float f1 = this.pitch; - super.V(); + super.ab(); this.bs = this.bt; this.bt = 0.0F; - this.k(this.locX - d0, this.locY - d1, this.locZ - d2); + this.l(this.locX - d0, this.locY - d1, this.locZ - d2); if (this.vehicle instanceof EntityPig) { this.pitch = f1; this.yaw = f; @@ -412,40 +370,39 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - protected void bl() { - super.bl(); - this.aW(); + protected void bq() { + super.bq(); + this.bb(); } - public void c() { + public void e() { if (this.br > 0) { --this.br; } - // CraftBukkit - this.getMaxHealth() -> this.maxHealth - if (this.world.difficulty == 0 && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) { + if (this.world.difficulty == EnumDifficulty.PEACEFUL && this.getHealth() < this.getMaxHealth() && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) { // CraftBukkit - added regain reason of "REGEN" for filtering purposes. this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); } this.inventory.k(); this.bs = this.bt; - super.c(); + super.e(); AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.d); if (!this.world.isStatic) { attributeinstance.setValue((double) this.abilities.b()); } - this.aR = this.bL; + this.aR = this.bK; if (this.isSprinting()) { - this.aR = (float) ((double) this.aR + (double) this.bL * 0.3D); + this.aR = (float) ((double) this.aR + (double) this.bK * 0.3D); } this.i((float) attributeinstance.getValue()); float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); // CraftBukkit - Math -> TrigMath - float f1 = (float) org.bukkit.craftbukkit.v1_6_R3.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; + float f1 = (float) org.bukkit.craftbukkit.v1_7_R1.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; if (f > 0.1F) { f = 0.1F; @@ -507,8 +464,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.a(0.2F, 0.2F); this.setPosition(this.locX, this.locY, this.locZ); this.motY = 0.10000000149011612D; - if (this.name.equals("Notch")) { - this.a(new ItemStack(Item.APPLE, 1), true); + if (this.getName().equals("Notch")) { + this.a(new ItemStack(Items.APPLE, 1), true, false); } if (!this.world.getGameRules().getBoolean("keepInventory")) { @@ -523,20 +480,28 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } this.height = 0.1F; - this.a(StatisticList.y, 1); + this.a(StatisticList.v, 1); + } + + protected String aT() { + return "game.player.hurt"; + } + + protected String aU() { + return "game.player.die"; } public void b(Entity entity, int i) { this.addScore(i); // CraftBukkit - Get our scores instead - Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getLocalizedName(), new java.util.ArrayList()); + Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getName(), new java.util.ArrayList()); if (entity instanceof EntityHuman) { - this.a(StatisticList.A, 1); + this.a(StatisticList.y, 1); // CraftBukkit - Get our scores instead - this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getLocalizedName(), collection); + this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), collection); } else { - this.a(StatisticList.z, 1); + this.a(StatisticList.w, 1); } Iterator iterator = collection.iterator(); @@ -549,14 +514,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public EntityItem a(boolean flag) { - return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false); + return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true); } - public EntityItem drop(ItemStack itemstack) { - return this.a(itemstack, false); + public EntityItem drop(ItemStack itemstack, boolean flag) { + return this.a(itemstack, false, false); } - public EntityItem a(ItemStack itemstack, boolean flag) { + public EntityItem a(ItemStack itemstack, boolean flag, boolean flag1) { if (itemstack == null) { return null; } else if (itemstack.count == 0) { @@ -565,6 +530,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack); entityitem.pickupDelay = 40; + if (flag1) { + entityitem.b(this.getName()); + } + float f = 0.1F; float f1; @@ -602,7 +571,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen // CraftBukkit end this.a(entityitem); - this.a(StatisticList.v, 1); + this.a(StatisticList.s, 1); return entityitem; } } @@ -654,7 +623,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.getList("Inventory"); + this.uniqueID = a(this.i); + NBTTagList nbttaglist = nbttagcompound.getList("Inventory", 10); this.inventory.b(nbttaglist); this.inventory.itemInHandIndex = nbttagcompound.getInt("SelectedItemSlot"); @@ -665,7 +635,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.expTotal = nbttagcompound.getInt("XpTotal"); this.setScore(nbttagcompound.getInt("Score")); if (this.sleeping) { - this.bD = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); + this.bC = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); this.a(true, true, false); } @@ -676,15 +646,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } // CraftBukkit end - if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) { + if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.c = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.d = nbttagcompound.getBoolean("SpawnForced"); } this.foodData.a(nbttagcompound); this.abilities.b(nbttagcompound); - if (nbttagcompound.hasKey("EnderItems")) { - NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems"); + if (nbttagcompound.hasKeyOfType("EnderItems", 9)) { + NBTTagList nbttaglist1 = nbttagcompound.getList("EnderItems", 10); this.enderChest.a(nbttaglist1); } @@ -731,7 +701,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return 0.12F; } - protected void d_() { + protected void e_() { this.height = 1.62F; } @@ -749,16 +719,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.a(true, true, false); } - if (damagesource.p()) { - if (this.world.difficulty == 0) { - return false; // CraftBukkit - f = 0 -> return false + if (damagesource.r()) { + if (this.world.difficulty == EnumDifficulty.PEACEFUL) { + return false; // CraftBukkit - f = 0.0f -> return false } - if (this.world.difficulty == 1) { + if (this.world.difficulty == EnumDifficulty.EASY) { f = f / 2.0F + 1.0F; } - if (this.world.difficulty == 3) { + if (this.world.difficulty == EnumDifficulty.HARD) { f = f * 3.0F / 2.0F; } } @@ -772,7 +742,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen entity = ((EntityArrow) entity).shooter; } - this.a(StatisticList.x, Math.round(f * 10.0F)); + this.a(StatisticList.u, Math.round(f * 10.0F)); return super.damageEntity(damagesource, f); } } @@ -791,7 +761,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } else { // This should never be called, but is implemented anyway - org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.name); + org.bukkit.OfflinePlayer thisPlayer = entityhuman.world.getServer().getOfflinePlayer(entityhuman.getName()); team = entityhuman.world.getServer().getScoreboardManager().getMainScoreboard().getPlayerTeam(thisPlayer); if (team == null || team.allowFriendlyFire()) { return true; @@ -801,7 +771,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (this instanceof EntityPlayer) { return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity()); } - return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.name)); + return !team.hasPlayer(this.world.getServer().getOfflinePlayer(this.getName())); // CraftBukkit end } @@ -809,11 +779,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.inventory.a(f); } - public int aQ() { + public int aV() { return this.inventory.l(); } - public float bx() { + public float bC() { int i = 0; ItemStack[] aitemstack = this.inventory.armor; int j = aitemstack.length; @@ -839,14 +809,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen f = this.c(damagesource, f); float f1 = f; - f = Math.max(f - this.bn(), 0.0F); - this.m(this.bn() - (f1 - f)); + f = Math.max(f - this.bs(), 0.0F); + this.m(this.bs() - (f1 - f)); if (f != 0.0F) { this.a(damagesource.f()); float f2 = this.getHealth(); this.setHealth(this.getHealth() - f); - this.aR().a(damagesource, f2, f); + this.aW().a(damagesource, f2, f); } } } @@ -857,16 +827,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void a(TileEntity tileentity) {} + public void a(CommandBlockListenerAbstract commandblocklistenerabstract) {} + public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {} public void openBeacon(TileEntityBeacon tileentitybeacon) {} public void openTrade(IMerchant imerchant, String s) {} - public void c(ItemStack itemstack) {} + public void b(ItemStack itemstack) {} public boolean p(Entity entity) { - ItemStack itemstack = this.by(); + ItemStack itemstack = this.bD(); ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null; if (!entity.c(this)) { @@ -878,7 +850,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (itemstack.a(this, (EntityLiving) entity)) { // CraftBukkit - bypass infinite items; <= 0 -> == 0 if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) { - this.bz(); + this.bE(); } return true; @@ -887,9 +859,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return false; } else { - if (itemstack != null && itemstack == this.by()) { + if (itemstack != null && itemstack == this.bD()) { if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) { - this.bz(); + this.bE(); } else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) { itemstack.count = itemstack1.count; } @@ -899,20 +871,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public ItemStack by() { + public ItemStack bD() { return this.inventory.getItemInHand(); } - public void bz() { + public void bE() { this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null); } - public double X() { + public double ad() { return (double) (this.height - 0.5F); } public void attack(Entity entity) { - if (entity.aq()) { + if (entity.av()) { if (!entity.i(this)) { float f = (float) this.getAttributeInstance(GenericAttributes.e).getValue(); int i = 0; @@ -928,7 +900,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } if (f > 0.0F || f1 > 0.0F) { - boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.e() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; + boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.h_() && !this.M() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving; if (flag && f > 0.0F) { f *= 1.5F; @@ -945,15 +917,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f); - // CraftBukkit start - Return when the damage fails so that the item will not lose durability - if (!flag2) { - if (flag1) { - entity.extinguish(); - } - return; - } - // CraftBukkit end - if (flag2) { if (i > 0) { entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F)); @@ -971,51 +934,52 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } if (f >= 18.0F) { - this.a((Statistic) AchievementList.E); + this.a((Statistic) AchievementList.F); } this.k(entity); if (entity instanceof EntityLiving) { - EnchantmentThorns.a(this, (EntityLiving) entity, this.random); + EnchantmentManager.a((EntityLiving) entity, (Entity) this); } - } - ItemStack itemstack = this.by(); - Object object = entity; + EnchantmentManager.b(this, entity); + ItemStack itemstack = this.bD(); + Object object = entity; - if (entity instanceof EntityComplexPart) { - IComplex icomplex = ((EntityComplexPart) entity).owner; + if (entity instanceof EntityComplexPart) { + IComplex icomplex = ((EntityComplexPart) entity).owner; - if (icomplex != null && icomplex instanceof EntityLiving) { - object = (EntityLiving) icomplex; - } - } - - if (itemstack != null && object instanceof EntityLiving) { - itemstack.a((EntityLiving) object, this); - // CraftBukkit - bypass infinite items; <= 0 -> == 0 - if (itemstack.count == 0) { - this.bz(); - } - } - - if (entity instanceof EntityLiving) { - this.a(StatisticList.w, Math.round(f * 10.0F)); - if (j > 0 && flag2) { - // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item - EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4); - org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); - - if (!combustEvent.isCancelled()) { - entity.setOnFire(combustEvent.getDuration()); + if (icomplex != null && icomplex instanceof EntityLiving) { + object = (EntityLiving) icomplex; } - // CraftBukkit end - } else if (flag1) { - entity.extinguish(); } - } - this.a(0.3F); + if (itemstack != null && object instanceof EntityLiving) { + itemstack.a((EntityLiving) object, this); + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0) { + this.bE(); + } + } + + if (entity instanceof EntityLiving) { + this.a(StatisticList.t, Math.round(f * 10.0F)); + if (j > 0) { + // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item + EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4); + org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); + + if (!combustEvent.isCancelled()) { + entity.setOnFire(combustEvent.getDuration()); + } + // CraftBukkit end + } + } + + this.a(0.3F); + } else if (flag1) { + entity.extinguish(); + } } } } @@ -1037,6 +1001,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return !this.sleeping && super.inBlock(); } + public GameProfile getProfile() { + return this.i; + } + public EnumBedResult a(int i, int j, int k) { if (!this.world.isStatic) { if (this.isSleeping() || !this.isAlive()) { @@ -1064,7 +1032,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - if (this.ag()) { + if (this.am()) { this.mount((Entity) null); } @@ -1086,7 +1054,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.height = 0.2F; if (this.world.isLoaded(i, j, k)) { int l = this.world.getData(i, j, k); - int i1 = BlockBed.j(l); + int i1 = BlockBed.l(l); float f = 0.5F; float f1 = 0.5F; @@ -1107,7 +1075,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen f = 0.9F; } - this.t(i1); + this.w(i1); this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1)); } else { this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F)); @@ -1115,7 +1083,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.sleeping = true; this.sleepTicks = 0; - this.bD = new ChunkCoordinates(i, j, k); + this.bC = new ChunkCoordinates(i, j, k); this.motX = this.motZ = this.motY = 0.0D; if (!this.world.isStatic) { this.world.everyoneSleeping(); @@ -1124,36 +1092,36 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return EnumBedResult.OK; } - private void t(int i) { + private void w(int i) { + this.bD = 0.0F; this.bE = 0.0F; - this.bF = 0.0F; switch (i) { case 0: - this.bF = -1.8F; + this.bE = -1.8F; break; case 1: - this.bE = 1.8F; + this.bD = 1.8F; break; case 2: - this.bF = 1.8F; + this.bE = 1.8F; break; case 3: - this.bE = -1.8F; + this.bD = -1.8F; } } public void a(boolean flag, boolean flag1, boolean flag2) { this.a(0.6F, 1.8F); - this.d_(); - ChunkCoordinates chunkcoordinates = this.bD; - ChunkCoordinates chunkcoordinates1 = this.bD; + this.e_(); + ChunkCoordinates chunkcoordinates = this.bC; + ChunkCoordinates chunkcoordinates1 = this.bC; - if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { + if (chunkcoordinates != null && this.world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Blocks.BED) { BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false); - chunkcoordinates1 = BlockBed.b(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0); + chunkcoordinates1 = BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0); if (chunkcoordinates1 == null) { chunkcoordinates1 = new ChunkCoordinates(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z); } @@ -1189,28 +1157,28 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } if (flag2) { - this.setRespawnPosition(this.bD, false); + this.setRespawnPosition(this.bC, false); } } - private boolean h() { - return this.world.getTypeId(this.bD.x, this.bD.y, this.bD.z) == Block.BED.id; + private boolean j() { + return this.world.getType(this.bC.x, this.bC.y, this.bC.z) == Blocks.BED; } public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) { - IChunkProvider ichunkprovider = world.L(); + IChunkProvider ichunkprovider = world.K(); ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4); ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4); ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4); ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4); - if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) { - ChunkCoordinates chunkcoordinates1 = BlockBed.b(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0); + if (world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Blocks.BED) { + ChunkCoordinates chunkcoordinates1 = BlockBed.a(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0); return chunkcoordinates1; } else { - Material material = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z); - Material material1 = world.getMaterial(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z); + Material material = world.getType(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z).getMaterial(); + Material material1 = world.getType(chunkcoordinates.x, chunkcoordinates.y + 1, chunkcoordinates.z).getMaterial(); boolean flag1 = !material.isBuildable() && !material.isLiquid(); boolean flag2 = !material1.isBuildable() && !material1.isLiquid(); @@ -1236,7 +1204,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public void a(String s) {} + public void b(IChatBaseComponent ichatbasecomponent) {} public ChunkCoordinates getBed() { return this.c; @@ -1264,9 +1232,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void a(Statistic statistic, int i) {} - protected void be() { - super.be(); - this.a(StatisticList.u, 1); + public void bj() { + super.bj(); + this.a(StatisticList.r, 1); if (this.isSprinting()) { this.a(0.8F); } else { @@ -1294,7 +1262,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2); } - public float bg() { + public float bl() { return (float) this.getAttributeInstance(GenericAttributes.d).getValue(); } @@ -1304,24 +1272,24 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (this.a(Material.WATER)) { i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); - if (i > 0) { - this.a(StatisticList.q, i); - this.a(0.015F * (float) i * 0.01F); - } - } else if (this.H()) { - i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); if (i > 0) { this.a(StatisticList.m, i); this.a(0.015F * (float) i * 0.01F); } - } else if (this.e()) { + } else if (this.M()) { + i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); + if (i > 0) { + this.a(StatisticList.i, i); + this.a(0.015F * (float) i * 0.01F); + } + } else if (this.h_()) { if (d1 > 0.0D) { - this.a(StatisticList.o, (int) Math.round(d1 * 100.0D)); + this.a(StatisticList.k, (int) Math.round(d1 * 100.0D)); } } else if (this.onGround) { i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); if (i > 0) { - this.a(StatisticList.l, i); + this.a(StatisticList.h, i); if (this.isSprinting()) { this.a(0.099999994F * (float) i * 0.01F); } else { @@ -1331,28 +1299,30 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } else { i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F); if (i > 25) { - this.a(StatisticList.p, i); + this.a(StatisticList.l, i); } } } } - private void k(double d0, double d1, double d2) { + private void l(double d0, double d1, double d2) { if (this.vehicle != null) { int i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); if (i > 0) { if (this.vehicle instanceof EntityMinecartAbstract) { - this.a(StatisticList.r, i); + this.a(StatisticList.n, i); if (this.e == null) { this.e = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); } else if ((double) this.e.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) >= 1000000.0D) { this.a((Statistic) AchievementList.q, 1); } } else if (this.vehicle instanceof EntityBoat) { - this.a(StatisticList.s, i); + this.a(StatisticList.o, i); } else if (this.vehicle instanceof EntityPig) { - this.a(StatisticList.t, i); + this.a(StatisticList.p, i); + } else if (this.vehicle instanceof EntityHorse) { + this.a(StatisticList.q, i); } } } @@ -1361,27 +1331,38 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen protected void b(float f) { if (!this.abilities.canFly) { if (f >= 2.0F) { - this.a(StatisticList.n, (int) Math.round((double) f * 100.0D)); + this.a(StatisticList.j, (int) Math.round((double) f * 100.0D)); } super.b(f); } } + protected String o(int i) { + return i > 4 ? "game.player.hurt.fall.big" : "game.player.hurt.fall.small"; + } + public void a(EntityLiving entityliving) { if (entityliving instanceof IMonster) { this.a((Statistic) AchievementList.s); } - } - public void am() { - if (!this.abilities.isFlying) { - super.am(); + int i = EntityTypes.a(entityliving); + MonsterEggInfo monsteregginfo = (MonsterEggInfo) EntityTypes.a.get(Integer.valueOf(i)); + + if (monsteregginfo != null) { + this.a(monsteregginfo.d, 1); } } - public ItemStack o(int i) { - return this.inventory.f(i); + public void as() { + if (!this.abilities.isFlying) { + super.as(); + } + } + + public ItemStack r(int i) { + return this.inventory.d(i); } public void giveExp(int i) { @@ -1436,8 +1417,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return (flag || this.foodData.c()) && !this.abilities.isInvulnerable; } - public boolean bJ() { - return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth(); // CraftBukkit - this.getMaxHealth() -> this.maxHealth + public boolean bP() { + return this.getHealth() > 0.0F && this.getHealth() < this.getMaxHealth(); } public void a(ItemStack itemstack, int i) { @@ -1454,17 +1435,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (this.abilities.mayBuild) { return true; } else { - int l = this.world.getTypeId(i, j, k); + Block block = this.world.getType(i, j, k); - if (l > 0) { - Block block = Block.byId[l]; - - if (block.material.q()) { + if (block.getMaterial() != Material.AIR) { + if (block.getMaterial().q()) { return true; } - if (this.by() != null) { - ItemStack itemstack = this.by(); + if (this.bD() != null) { + ItemStack itemstack = this.bD(); if (itemstack.b(block) || itemstack.a(block) > 1.0F) { return true; @@ -1494,10 +1473,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return true; } - public String getLocalizedName() { - return this.name; - } - public void copyTo(EntityHuman entityhuman, boolean flag) { if (flag) { this.inventory.b(entityhuman.inventory); @@ -1507,7 +1482,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.expTotal = entityhuman.expTotal; this.exp = entityhuman.exp; this.setScore(entityhuman.getScore()); - this.as = entityhuman.as; + this.ar = entityhuman.ar; } else if (this.world.getGameRules().getBoolean("keepInventory")) { this.inventory.b(entityhuman.inventory); this.expLevel = entityhuman.expLevel; @@ -1519,7 +1494,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.enderChest = entityhuman.enderChest; } - protected boolean e_() { + protected boolean g_() { return !this.abilities.isFlying; } @@ -1528,10 +1503,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen public void a(EnumGamemode enumgamemode) {} public String getName() { - return this.name; + return this.i.getName(); } - public World f_() { + public World getWorld() { return this.world; } @@ -1543,7 +1518,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1]; } - public ItemStack aZ() { + public ItemStack be() { return this.inventory.getItemInHand(); } @@ -1555,7 +1530,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return this.inventory.armor; } - public boolean ax() { + public boolean aC() { return !this.abilities.isFlying; } @@ -1564,12 +1539,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public ScoreboardTeamBase getScoreboardTeam() { - return this.getScoreboard().getPlayerTeam(this.name); + return this.getScoreboard().getPlayerTeam(this.getName()); } - public String getScoreboardDisplayName() { + public IChatBaseComponent getScoreboardDisplayName() { // CraftBukkit todo: fun - return ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.name); + ChatComponentText chatcomponenttext = new ChatComponentText(ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.getName())); + + chatcomponenttext.b().a(new ChatClickable(EnumClickAction.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + return chatcomponenttext; } public void m(float f) { @@ -1580,7 +1558,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.getDataWatcher().watch(17, Float.valueOf(f)); } - public float bn() { + public float bs() { return this.getDataWatcher().getFloat(17); } + + public static UUID a(GameProfile gameprofile) { + UUID uuid = UtilUUID.b(gameprofile.getId()); + + if (uuid == null) { + uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + gameprofile.getName()).getBytes(Charsets.UTF_8)); + } + + return uuid; + } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityInsentient.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityInsentient.java similarity index 76% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityInsentient.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityInsentient.java index 7b2e30a52..0c5274fb2 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityInsentient.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityInsentient.java @@ -1,47 +1,13 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.Iterator; import java.util.List; import java.util.UUID; -import net.minecraft.server.v1_6_R3.AttributeModifier; -import net.minecraft.server.v1_6_R3.Block; -import net.minecraft.server.v1_6_R3.ControllerJump; -import net.minecraft.server.v1_6_R3.ControllerLook; -import net.minecraft.server.v1_6_R3.ControllerMove; -import net.minecraft.server.v1_6_R3.EnchantmentManager; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityAIBodyControl; -import net.minecraft.server.v1_6_R3.EntityCreeper; -import net.minecraft.server.v1_6_R3.EntityGhast; -import net.minecraft.server.v1_6_R3.EntityHanging; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityItem; -import net.minecraft.server.v1_6_R3.EntityLeash; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EntitySenses; -import net.minecraft.server.v1_6_R3.EntityTameableAnimal; -import net.minecraft.server.v1_6_R3.GenericAttributes; -import net.minecraft.server.v1_6_R3.GroupDataEntity; -import net.minecraft.server.v1_6_R3.IMonster; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.ItemArmor; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.ItemSword; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.NBTTagFloat; -import net.minecraft.server.v1_6_R3.NBTTagList; -import net.minecraft.server.v1_6_R3.Navigation; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet39AttachEntity; -import net.minecraft.server.v1_6_R3.PathfinderGoalSelector; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldServer; - // CraftBukkit start -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; +import org.bukkit.event.entity.EntityUnleashEvent; +import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; // CraftBukkit end public abstract class EntityInsentient extends EntityLiving { @@ -67,11 +33,11 @@ public abstract class EntityInsentient extends EntityLiving { private boolean bv; private Entity bw; private NBTTagCompound bx; - + public boolean Vegetated; public boolean BreakLeash = true; public boolean PullWhileLeashed = true; - + public EntityInsentient(World world) { super(world); this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null); @@ -88,9 +54,9 @@ public abstract class EntityInsentient extends EntityLiving { } } - protected void az() { - super.az(); - this.aX().b(GenericAttributes.b).setValue(16.0D); + protected void aD() { + super.aD(); + this.bc().b(GenericAttributes.b).setValue(16.0D); } public ControllerLook getControllerLook() { @@ -125,32 +91,32 @@ public abstract class EntityInsentient extends EntityLiving { return EntityCreeper.class != oclass && EntityGhast.class != oclass; } - public void n() {} + public void p() {} - protected void a() { - super.a(); + protected void c() { + super.c(); this.datawatcher.a(11, Byte.valueOf((byte) 0)); this.datawatcher.a(10, ""); } - public int o() { + public int q() { return 80; } - public void p() { - String s = this.r(); + public void r() { + String s = this.t(); if (s != null) { - this.makeSound(s, this.ba(), this.bb()); + this.makeSound(s, this.bf(), this.bg()); } } - public void y() { - super.y(); + public void C() { + super.C(); this.world.methodProfiler.a("mobBaseTick"); if (this.isAlive() && !Silent && this.random.nextInt(1000) < this.a_++) { - this.a_ = -this.o(); - this.p(); + this.a_ = -this.q(); + this.r(); } this.world.methodProfiler.b(); @@ -173,7 +139,7 @@ public abstract class EntityInsentient extends EntityLiving { } } - public void q() { + public void s() { for (int i = 0; i < 20; ++i) { double d0 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D; @@ -184,15 +150,15 @@ public abstract class EntityInsentient extends EntityLiving { } } - public void l_() { - super.l_(); + public void h() { + super.h(); if (!this.world.isStatic) { - this.bF(); + this.bJ(); } } protected float f(float f, float f1) { - if (this.bf()) { + if (this.bk()) { this.bn.a(); return f1; } else { @@ -200,28 +166,28 @@ public abstract class EntityInsentient extends EntityLiving { } } - protected String r() { + protected String t() { return null; } - protected int getLootId() { - return 0; + protected Item getLoot() { + return Item.d(0); } protected void dropDeathLoot(boolean flag, int i) { // CraftBukkit start - Whole method List loot = new java.util.ArrayList(); - int j = this.getLootId(); + Item item = this.getLoot(); - if (j > 0) { - int k = this.random.nextInt(3); + if (item != null) { + int j = this.random.nextInt(3); if (i > 0) { - k += this.random.nextInt(i + 1); + j += this.random.nextInt(i + 1); } - if (k > 0) { - loot.add(new org.bukkit.inventory.ItemStack(j, k)); + if (j > 0) { + loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers.getMaterial(item), j)); } } @@ -230,9 +196,9 @@ public abstract class EntityInsentient extends EntityLiving { int k = this.random.nextInt(200) - i; if (k < 5) { - ItemStack itemstack = this.l(k <= 0 ? 1 : 0); + ItemStack itemstack = this.getRareDrop(k <= 0 ? 1 : 0); if (itemstack != null) { - loot.add(org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack.asCraftMirror(itemstack)); + loot.add(org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack.asCraftMirror(itemstack)); } } } @@ -243,7 +209,7 @@ public abstract class EntityInsentient extends EntityLiving { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.setBoolean("CanPickUpLoot", this.bD()); + nbttagcompound.setBoolean("CanPickUpLoot", this.bH()); nbttagcompound.setBoolean("PersistenceRequired", this.persistent); NBTTagList nbttaglist = new NBTTagList(); @@ -262,7 +228,7 @@ public abstract class EntityInsentient extends EntityLiving { NBTTagList nbttaglist1 = new NBTTagList(); for (int j = 0; j < this.dropChances.length; ++j) { - nbttaglist1.add(new NBTTagFloat(j + "", this.dropChances[j])); + nbttaglist1.add(new NBTTagFloat(this.dropChances[j])); } nbttagcompound.set("DropChances", nbttaglist1); @@ -270,7 +236,7 @@ public abstract class EntityInsentient extends EntityLiving { nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible()); nbttagcompound.setBoolean("Leashed", this.bv); if (this.bw != null) { - nbttagcompound1 = new NBTTagCompound("Leash"); + nbttagcompound1 = new NBTTagCompound(); if (this.bw instanceof EntityLiving) { nbttagcompound1.setLong("UUIDMost", this.bw.getUniqueID().getMostSignificantBits()); nbttagcompound1.setLong("UUIDLeast", this.bw.getUniqueID().getLeastSignificantBits()); @@ -301,7 +267,7 @@ public abstract class EntityInsentient extends EntityLiving { } // CraftBukkit end - if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) { + if (nbttagcompound.hasKeyOfType("CustomName", 8) && nbttagcompound.getString("CustomName").length() > 0) { this.setCustomName(nbttagcompound.getString("CustomName")); } @@ -309,24 +275,24 @@ public abstract class EntityInsentient extends EntityLiving { NBTTagList nbttaglist; int i; - if (nbttagcompound.hasKey("Equipment")) { - nbttaglist = nbttagcompound.getList("Equipment"); + if (nbttagcompound.hasKeyOfType("Equipment", 9)) { + nbttaglist = nbttagcompound.getList("Equipment", 10); for (i = 0; i < this.equipment.length; ++i) { - this.equipment[i] = ItemStack.createStack((NBTTagCompound) nbttaglist.get(i)); + this.equipment[i] = ItemStack.createStack(nbttaglist.get(i)); } } - if (nbttagcompound.hasKey("DropChances")) { - nbttaglist = nbttagcompound.getList("DropChances"); + if (nbttagcompound.hasKeyOfType("DropChances", 9)) { + nbttaglist = nbttagcompound.getList("DropChances", 5); for (i = 0; i < nbttaglist.size(); ++i) { - this.dropChances[i] = ((NBTTagFloat) nbttaglist.get(i)).data; + this.dropChances[i] = nbttaglist.e(i); } } this.bv = nbttagcompound.getBoolean("Leashed"); - if (this.bv && nbttagcompound.hasKey("Leash")) { + if (this.bv && nbttagcompound.hasKeyOfType("Leash", 10)) { this.bx = nbttagcompound.getCompound("Leash"); } } @@ -340,10 +306,10 @@ public abstract class EntityInsentient extends EntityLiving { this.n(f); } - public void c() { - super.c(); + public void e() { + super.e(); this.world.methodProfiler.a("looting"); - if (!this.world.isStatic && this.bD() && !this.aU && this.world.getGameRules().getBoolean("mobGriefing")) { + if (!this.world.isStatic && this.bH() && !this.aU && this.world.getGameRules().getBoolean("mobGriefing")) { List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D)); Iterator iterator = list.iterator(); @@ -366,10 +332,10 @@ public abstract class EntityInsentient extends EntityLiving { ItemSword itemsword = (ItemSword) itemstack.getItem(); ItemSword itemsword1 = (ItemSword) itemstack1.getItem(); - if (itemsword.g() == itemsword1.g()) { + if (itemsword.i() == itemsword1.i()) { flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag(); } else { - flag = itemsword.g() > itemsword1.g(); + flag = itemsword.i() > itemsword1.i(); } } else { flag = false; @@ -395,6 +361,14 @@ public abstract class EntityInsentient extends EntityLiving { this.a(itemstack1, 0.0F); } + if (itemstack.getItem() == Items.DIAMOND && entityitem.j() != null) { + EntityHuman entityhuman = this.world.a(entityitem.j()); + + if (entityhuman != null) { + entityhuman.a((Statistic) AchievementList.x); + } + } + this.setEquipment(i, itemstack); this.dropChances[i] = 2.0F; this.persistent = true; @@ -409,7 +383,7 @@ public abstract class EntityInsentient extends EntityLiving { this.world.methodProfiler.b(); } - protected boolean bf() { + protected boolean bk() { return false; } @@ -417,7 +391,7 @@ public abstract class EntityInsentient extends EntityLiving { return true; } - protected void u() { + protected void w() { if (this.persistent) { this.aV = 0; } else { @@ -442,10 +416,10 @@ public abstract class EntityInsentient extends EntityLiving { } } - protected void bi() { + protected void bn() { ++this.aV; this.world.methodProfiler.a("checkDespawn"); - this.u(); + this.w(); this.world.methodProfiler.b(); this.world.methodProfiler.a("sensing"); this.bq.a(); @@ -460,7 +434,7 @@ public abstract class EntityInsentient extends EntityLiving { this.navigation.f(); this.world.methodProfiler.b(); this.world.methodProfiler.a("mob tick"); - this.bk(); + this.bp(); this.world.methodProfiler.b(); this.world.methodProfiler.a("controls"); this.world.methodProfiler.a("move"); @@ -473,11 +447,11 @@ public abstract class EntityInsentient extends EntityLiving { this.world.methodProfiler.b(); } - protected void bl() { - super.bl(); + protected void bq() { + super.bq(); this.be = 0.0F; this.bf = 0.0F; - this.u(); + this.w(); float f = 8.0F; if (this.random.nextFloat() < 0.02F) { @@ -492,7 +466,7 @@ public abstract class EntityInsentient extends EntityLiving { } if (this.bu != null) { - this.a(this.bu, 10.0F, (float) this.bp()); + this.a(this.bu, 10.0F, (float) this.x()); if (this.g-- <= 0 || this.bu.dead || this.bu.e((Entity) this) > (double) (f * f)) { this.bu = null; } @@ -505,15 +479,15 @@ public abstract class EntityInsentient extends EntityLiving { this.pitch = this.f; } - boolean flag = this.H(); - boolean flag1 = this.J(); + boolean flag = this.M(); + boolean flag1 = this.P(); if (flag || flag1) { this.bd = this.random.nextFloat() < 0.8F; } } - public int bp() { + public int x() { return 40; } @@ -556,17 +530,17 @@ public abstract class EntityInsentient extends EntityLiving { return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox); } - public int bv() { + public int bz() { return 4; } - public int as() { + public int ax() { if (this.getGoalTarget() == null) { return 3; } else { int i = (int) (this.getHealth() - this.getMaxHealth() * 0.33F); - i -= (3 - this.world.difficulty) * 4; + i -= (3 - this.world.difficulty.a()) * 4; if (i < 0) { i = 0; } @@ -575,7 +549,7 @@ public abstract class EntityInsentient extends EntityLiving { } } - public ItemStack aZ() { + public ItemStack be() { return this.equipment[0]; } @@ -583,7 +557,7 @@ public abstract class EntityInsentient extends EntityLiving { return this.equipment[i]; } - public ItemStack o(int i) { + public ItemStack r(int i) { return this.equipment[i + 1]; } @@ -621,10 +595,10 @@ public abstract class EntityInsentient extends EntityLiving { } } - protected void bw() { + protected void bA() { if (this.random.nextFloat() < 0.15F * this.world.b(this.locX, this.locY, this.locZ)) { int i = this.random.nextInt(2); - float f = this.world.difficulty == 3 ? 0.1F : 0.25F; + float f = this.world.difficulty == EnumDifficulty.HARD ? 0.1F : 0.25F; if (this.random.nextFloat() < 0.095F) { ++i; @@ -639,7 +613,7 @@ public abstract class EntityInsentient extends EntityLiving { } for (int j = 3; j >= 0; --j) { - ItemStack itemstack = this.o(j); + ItemStack itemstack = this.r(j); if (j < 3 && this.random.nextFloat() < f) { break; @@ -657,7 +631,7 @@ public abstract class EntityInsentient extends EntityLiving { } public static int b(ItemStack itemstack) { - if (itemstack.id != Block.PUMPKIN.id && itemstack.id != Item.SKULL.id) { + if (itemstack.getItem() != Item.getItemOf(Blocks.PUMPKIN) && itemstack.getItem() != Items.SKULL) { if (itemstack.getItem() instanceof ItemArmor) { switch (((ItemArmor) itemstack.getItem()).b) { case 0: @@ -684,54 +658,54 @@ public abstract class EntityInsentient extends EntityLiving { switch (i) { case 4: if (j == 0) { - return Item.LEATHER_HELMET; + return Items.LEATHER_HELMET; } else if (j == 1) { - return Item.GOLD_HELMET; + return Items.GOLD_HELMET; } else if (j == 2) { - return Item.CHAINMAIL_HELMET; + return Items.CHAINMAIL_HELMET; } else if (j == 3) { - return Item.IRON_HELMET; + return Items.IRON_HELMET; } else if (j == 4) { - return Item.DIAMOND_HELMET; + return Items.DIAMOND_HELMET; } case 3: if (j == 0) { - return Item.LEATHER_CHESTPLATE; + return Items.LEATHER_CHESTPLATE; } else if (j == 1) { - return Item.GOLD_CHESTPLATE; + return Items.GOLD_CHESTPLATE; } else if (j == 2) { - return Item.CHAINMAIL_CHESTPLATE; + return Items.CHAINMAIL_CHESTPLATE; } else if (j == 3) { - return Item.IRON_CHESTPLATE; + return Items.IRON_CHESTPLATE; } else if (j == 4) { - return Item.DIAMOND_CHESTPLATE; + return Items.DIAMOND_CHESTPLATE; } case 2: if (j == 0) { - return Item.LEATHER_LEGGINGS; + return Items.LEATHER_LEGGINGS; } else if (j == 1) { - return Item.GOLD_LEGGINGS; + return Items.GOLD_LEGGINGS; } else if (j == 2) { - return Item.CHAINMAIL_LEGGINGS; + return Items.CHAINMAIL_LEGGINGS; } else if (j == 3) { - return Item.IRON_LEGGINGS; + return Items.IRON_LEGGINGS; } else if (j == 4) { - return Item.DIAMOND_LEGGINGS; + return Items.DIAMOND_LEGGINGS; } case 1: if (j == 0) { - return Item.LEATHER_BOOTS; + return Items.LEATHER_BOOTS; } else if (j == 1) { - return Item.GOLD_BOOTS; + return Items.GOLD_BOOTS; } else if (j == 2) { - return Item.CHAINMAIL_BOOTS; + return Items.CHAINMAIL_BOOTS; } else if (j == 3) { - return Item.IRON_BOOTS; + return Items.IRON_BOOTS; } else if (j == 4) { - return Item.DIAMOND_BOOTS; + return Items.DIAMOND_BOOTS; } default: @@ -739,15 +713,15 @@ public abstract class EntityInsentient extends EntityLiving { } } - protected void bx() { + protected void bB() { float f = this.world.b(this.locX, this.locY, this.locZ); - if (this.aZ() != null && this.random.nextFloat() < 0.25F * f) { - EnchantmentManager.a(this.random, this.aZ(), (int) (5.0F + f * (float) this.random.nextInt(18))); + if (this.be() != null && this.random.nextFloat() < 0.25F * f) { + EnchantmentManager.a(this.random, this.be(), (int) (5.0F + f * (float) this.random.nextInt(18))); } for (int i = 0; i < 4; ++i) { - ItemStack itemstack = this.o(i); + ItemStack itemstack = this.r(i); if (itemstack != null && this.random.nextFloat() < 0.5F * f) { EnchantmentManager.a(this.random, itemstack, (int) (5.0F + f * (float) this.random.nextInt(18))); @@ -760,15 +734,15 @@ public abstract class EntityInsentient extends EntityLiving { return groupdataentity; } - public boolean by() { + public boolean bC() { return false; } - public String getLocalizedName() { - return this.hasCustomName() ? this.getCustomName() : super.getLocalizedName(); + public String getName() { + return this.hasCustomName() ? this.getCustomName() : super.getName(); } - public void bz() { + public void bD() { this.persistent = true; } @@ -796,7 +770,7 @@ public abstract class EntityInsentient extends EntityLiving { this.dropChances[i] = f; } - public boolean bD() { + public boolean bH() { return this.canPickUpLoot; } @@ -809,38 +783,38 @@ public abstract class EntityInsentient extends EntityLiving { } public final boolean c(EntityHuman entityhuman) { - if (this.bH() && this.getLeashHolder() == entityhuman && BreakLeash) { - // CraftBukkit start - if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { - ((EntityPlayer)entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, this, this.getLeashHolder())); - return false; - } - // CraftBukkit end + if (this.bL() && this.getLeashHolder() == entityhuman && BreakLeash) { + // CraftBukkit start + if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); + return false; + } + // CraftBukkit end this.unleash(true, !entityhuman.abilities.canInstantlyBuild); return true; } else { ItemStack itemstack = entityhuman.inventory.getItemInHand(); - if (itemstack != null && itemstack.id == Item.LEASH.id && this.bG()) { + if (itemstack != null && itemstack.getItem() == Items.LEASH && this.bK()) { if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) { - // CraftBukkit start - if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) { - ((EntityPlayer)entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, this, this.getLeashHolder())); - return false; - } - // CraftBukkit end + // CraftBukkit start + if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); + return false; + } + // CraftBukkit end this.setLeashHolder(entityhuman, true); --itemstack.count; return true; } if (entityhuman.getName().equalsIgnoreCase(((EntityTameableAnimal) this).getOwnerName())) { - // CraftBukkit start - if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) { - ((EntityPlayer)entityhuman).playerConnection.sendPacket(new Packet39AttachEntity(1, this, this.getLeashHolder())); - return false; - } - // CraftBukkit end + // CraftBukkit start + if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); + return false; + } + // CraftBukkit end this.setLeashHolder(entityhuman, true); --itemstack.count; return true; @@ -855,13 +829,14 @@ public abstract class EntityInsentient extends EntityLiving { return false; } - protected void bF() { + protected void bJ() { if (this.bx != null) { - this.bJ(); + this.bN(); } if (this.bv) { if (this.bw == null || this.bw.dead) { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit this.unleash(true, true); } } @@ -872,20 +847,20 @@ public abstract class EntityInsentient extends EntityLiving { this.bv = false; this.bw = null; if (!this.world.isStatic && flag1) { - this.b(Item.LEASH.id, 1); + this.a(Items.LEASH, 1); } if (!this.world.isStatic && flag && this.world instanceof WorldServer) { - ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet39AttachEntity(1, this, (Entity) null))); + ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAttachEntity(1, this, (Entity) null))); } } } - public boolean bG() { - return !this.bH() && !(this instanceof IMonster); + public boolean bK() { + return !this.bL() && !(this instanceof IMonster); } - public boolean bH() { + public boolean bL() { return this.bv; } @@ -897,13 +872,13 @@ public abstract class EntityInsentient extends EntityLiving { this.bv = true; this.bw = entity; if (!this.world.isStatic && flag && this.world instanceof WorldServer) { - ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet39AttachEntity(1, this, this.bw))); + ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAttachEntity(1, this, this.bw))); } } - private void bJ() { + private void bN() { if (this.bv && this.bx != null) { - if (this.bx.hasKey("UUIDMost") && this.bx.hasKey("UUIDLeast")) { + if (this.bx.hasKeyOfType("UUIDMost", 4) && this.bx.hasKeyOfType("UUIDLeast", 4)) { UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast")); List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D)); Iterator iterator = list.iterator(); @@ -916,7 +891,7 @@ public abstract class EntityInsentient extends EntityLiving { break; } } - } else if (this.bx.hasKey("X") && this.bx.hasKey("Y") && this.bx.hasKey("Z")) { + } else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) { int i = this.bx.getInt("X"); int j = this.bx.getInt("Y"); int k = this.bx.getInt("Z"); @@ -928,6 +903,7 @@ public abstract class EntityInsentient extends EntityLiving { this.bw = entityleash; } else { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(false, true); } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityLiving.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityLiving.java similarity index 81% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityLiving.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityLiving.java index 7d42de259..11b09e61a 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityLiving.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityLiving.java @@ -1,4 +1,4 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.Collection; import java.util.HashMap; @@ -8,7 +8,7 @@ import java.util.Random; import java.util.UUID; // CraftBukkit start -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; // CraftBukkit end @@ -78,73 +78,80 @@ public abstract class EntityLiving extends Entity { public int expToDrop; public int maxAirTicks = 300; // CraftBukkit end - - public boolean ghost; // Mineplex + public boolean ghost; // Mineplex + public EntityLiving(World world) { super(world); - this.az(); + this.aD(); // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor this.datawatcher.watch(6, (float) this.getAttributeInstance(GenericAttributes.a).getValue()); - this.m = true; + this.l = true; this.aM = (float) (Math.random() + 1.0D) * 0.01F; this.setPosition(this.locX, this.locY, this.locZ); this.aL = (float) Math.random() * 12398.0F; this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D); this.aP = this.yaw; - this.Y = 0.5F; + this.X = 0.5F; } - protected void a() { + protected void c() { this.datawatcher.a(7, Integer.valueOf(0)); this.datawatcher.a(8, Byte.valueOf((byte) 0)); this.datawatcher.a(9, Byte.valueOf((byte) 0)); this.datawatcher.a(6, Float.valueOf(1.0F)); } - protected void az() { - this.aX().b(GenericAttributes.a); - this.aX().b(GenericAttributes.c); - this.aX().b(GenericAttributes.d); - if (!this.bf()) { + protected void aD() { + this.bc().b(GenericAttributes.a); + this.bc().b(GenericAttributes.c); + this.bc().b(GenericAttributes.d); + if (!this.bk()) { this.getAttributeInstance(GenericAttributes.d).setValue(0.10000000149011612D); } } protected void a(double d0, boolean flag) { - if (!this.H()) { - this.I(); + if (!this.M()) { + this.N(); } if (flag && this.fallDistance > 0.0F) { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); int k = MathHelper.floor(this.locZ); - int l = this.world.getTypeId(i, j, k); + Block block = this.world.getType(i, j, k); - if (l == 0) { - int i1 = this.world.e(i, j - 1, k); + if (block.getMaterial() == Material.AIR) { + int l = this.world.getType(i, j - 1, k).b(); - if (i1 == 11 || i1 == 32 || i1 == 21) { - l = this.world.getTypeId(i, j - 1, k); + if (l == 11 || l == 32 || l == 21) { + block = this.world.getType(i, j - 1, k); } + } else if (!this.world.isStatic && this.fallDistance > 3.0F) { + // CraftBukkit start - supply player as argument in particles for visibility API to work + if (this instanceof EntityPlayer) { + this.world.a((EntityHuman) this, 2006, i, j, k, MathHelper.f(this.fallDistance - 3.0F)); + ((EntityPlayer) this).playerConnection.sendPacket(new PacketPlayOutWorldEvent(2006, i, j, k, MathHelper.f(this.fallDistance - 3.0F), false)); + } else { + this.world.triggerEffect(2006, i, j, k, MathHelper.f(this.fallDistance - 3.0F)); + } + // CraftBukkit end } - if (l > 0) { - Block.byId[l].a(this.world, i, j, k, this, this.fallDistance); - } + block.a(this.world, i, j, k, this, this.fallDistance); } super.a(d0, flag); } - public boolean aA() { + public boolean aE() { return false; } - public void y() { + public void C() { this.aD = this.aE; - super.y(); + super.C(); this.world.methodProfiler.a("livingEntityBaseTick"); if (this.isAlive() && this.inBlock()) { this.damageEntity(DamageSource.STUCK, 1.0F); @@ -157,8 +164,8 @@ public abstract class EntityLiving extends Entity { boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable; if (this.isAlive() && this.a(Material.WATER)) { - if (!this.aA() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) { - this.setAirTicks(this.h(this.getAirTicks())); + if (!this.aE() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) { + this.setAirTicks(this.j(this.getAirTicks())); if (this.getAirTicks() == -20) { this.setAirTicks(0); @@ -174,8 +181,7 @@ public abstract class EntityLiving extends Entity { } } - this.extinguish(); - if (!this.world.isStatic && this.ag() && this.vehicle instanceof EntityLiving) { + if (!this.world.isStatic && this.am() && this.vehicle instanceof EntityLiving) { this.mount((Entity) null); } } else { @@ -186,6 +192,10 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } + if (this.isAlive() && this.L()) { + this.extinguish(); + } + this.aJ = this.aK; if (this.attackTicks > 0) { --this.attackTicks; @@ -195,13 +205,12 @@ public abstract class EntityLiving extends Entity { --this.hurtTicks; } - // CraftBukkit if (this.noDamageTicks > 0 && !(this instanceof EntityPlayer)) { --this.noDamageTicks; } if (this.getHealth() <= 0.0F) { - this.aB(); + this.aF(); } if (this.lastDamageByPlayerTime > 0) { @@ -214,11 +223,15 @@ public abstract class EntityLiving extends Entity { this.bn = null; } - if (this.lastDamager != null && !this.lastDamager.isAlive()) { - this.b((EntityLiving) null); + if (this.lastDamager != null) { + if (!this.lastDamager.isAlive()) { + this.b((EntityLiving) null); + } else if (this.ticksLived - this.j > 100) { + this.b((EntityLiving) null); + } } - this.aJ(); + this.removeAllEffects(); this.aZ = this.aY; this.aO = this.aN; this.aQ = this.aP; @@ -231,7 +244,7 @@ public abstract class EntityLiving extends Entity { public int getExpReward() { int exp = this.getExpValue(this.killer); - if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) { + if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.aG()) { return exp; } else { return 0; @@ -243,7 +256,7 @@ public abstract class EntityLiving extends Entity { return false; } - protected void aB() { + protected void aF() { ++this.deathTicks; if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) int i; @@ -271,7 +284,11 @@ public abstract class EntityLiving extends Entity { } } - protected int h(int i) { + protected boolean aG() { + return !this.isBaby(); + } + + protected int j(int i) { int j = EnchantmentManager.getOxygenEnchantmentLevel(this); return j > 0 && this.random.nextInt(j + 1) > 0 ? i : i - 1; @@ -285,7 +302,7 @@ public abstract class EntityLiving extends Entity { return false; } - public Random aD() { + public Random aI() { return this.random; } @@ -293,7 +310,7 @@ public abstract class EntityLiving extends Entity { return this.lastDamager; } - public int aF() { + public int aK() { return this.j; } @@ -302,11 +319,11 @@ public abstract class EntityLiving extends Entity { this.j = this.ticksLived; } - public EntityLiving aG() { + public EntityLiving aL() { return this.bn; } - public int aH() { + public int aM() { return this.bo; } @@ -320,7 +337,7 @@ public abstract class EntityLiving extends Entity { this.bo = this.ticksLived; } - public int aI() { + public int aN() { return this.aV; } @@ -330,7 +347,7 @@ public abstract class EntityLiving extends Entity { nbttagcompound.setShort("HurtTime", (short) this.hurtTicks); nbttagcompound.setShort("DeathTime", (short) this.deathTicks); nbttagcompound.setShort("AttackTime", (short) this.attackTicks); - nbttagcompound.setFloat("AbsorptionAmount", this.bn()); + nbttagcompound.setFloat("AbsorptionAmount", this.bs()); ItemStack[] aitemstack = this.getEquipment(); int i = aitemstack.length; @@ -344,7 +361,7 @@ public abstract class EntityLiving extends Entity { } } - nbttagcompound.set("Attributes", GenericAttributes.a(this.aX())); + nbttagcompound.set("Attributes", GenericAttributes.a(this.bc())); aitemstack = this.getEquipment(); i = aitemstack.length; @@ -371,18 +388,20 @@ public abstract class EntityLiving extends Entity { public void a(NBTTagCompound nbttagcompound) { this.m(nbttagcompound.getFloat("AbsorptionAmount")); - if (nbttagcompound.hasKey("Attributes") && this.world != null && !this.world.isStatic) { - GenericAttributes.a(this.aX(), nbttagcompound.getList("Attributes"), this.world == null ? null : this.world.getLogger()); + if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isStatic) { + GenericAttributes.a(this.bc(), nbttagcompound.getList("Attributes", 10)); } - if (nbttagcompound.hasKey("ActiveEffects")) { - NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects"); + if (nbttagcompound.hasKeyOfType("ActiveEffects", 9)) { + NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects", 10); for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + NBTTagCompound nbttagcompound1 = nbttaglist.get(i); MobEffect mobeffect = MobEffect.b(nbttagcompound1); - this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect); + if (mobeffect != null) { + this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect); + } } } @@ -390,14 +409,14 @@ public abstract class EntityLiving extends Entity { if (nbttagcompound.hasKey("Bukkit.MaxHealth")) { NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth"); if (nbtbase.getTypeId() == 5) { - this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagFloat) nbtbase).data); + this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagFloat) nbtbase).c()); } else if (nbtbase.getTypeId() == 3) { - this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagInt) nbtbase).data); + this.getAttributeInstance(GenericAttributes.a).setValue((double) ((NBTTagInt) nbtbase).d()); } } // CraftBukkit end - if (nbttagcompound.hasKey("HealF")) { + if (nbttagcompound.hasKeyOfType("HealF", 99)) { this.setHealth(nbttagcompound.getFloat("HealF")); } else { NBTBase nbtbase = nbttagcompound.get("Health"); @@ -405,9 +424,9 @@ public abstract class EntityLiving extends Entity { if (nbtbase == null) { this.setHealth(this.getMaxHealth()); } else if (nbtbase.getTypeId() == 5) { - this.setHealth(((NBTTagFloat) nbtbase).data); + this.setHealth(((NBTTagFloat) nbtbase).h()); } else if (nbtbase.getTypeId() == 2) { - this.setHealth((float) ((NBTTagShort) nbtbase).data); + this.setHealth((float) ((NBTTagShort) nbtbase).e()); } } @@ -416,7 +435,7 @@ public abstract class EntityLiving extends Entity { this.attackTicks = nbttagcompound.getShort("AttackTime"); } - protected void aJ() { + protected void removeAllEffects() { Iterator iterator = this.effects.keySet().iterator(); while (iterator.hasNext()) { @@ -478,7 +497,7 @@ public abstract class EntityLiving extends Entity { } } - public void aK() { + public void aP() { Iterator iterator = this.effects.keySet().iterator(); while (iterator.hasNext()) { @@ -534,11 +553,11 @@ public abstract class EntityLiving extends Entity { return true; } - public boolean aM() { + public boolean aR() { return this.getMonsterType() == EnumMonsterType.UNDEAD; } - public void k(int i) { + public void m(int i) { MobEffect mobeffect = (MobEffect) this.effects.remove(Integer.valueOf(i)); if (mobeffect != null) { @@ -549,22 +568,22 @@ public abstract class EntityLiving extends Entity { protected void a(MobEffect mobeffect) { this.updateEffects = true; if (!this.world.isStatic) { - MobEffectList.byId[mobeffect.getEffectId()].b(this, this.aX(), mobeffect.getAmplifier()); + MobEffectList.byId[mobeffect.getEffectId()].b(this, this.bc(), mobeffect.getAmplifier()); } } protected void a(MobEffect mobeffect, boolean flag) { this.updateEffects = true; if (flag && !this.world.isStatic) { - MobEffectList.byId[mobeffect.getEffectId()].a(this, this.aX(), mobeffect.getAmplifier()); - MobEffectList.byId[mobeffect.getEffectId()].b(this, this.aX(), mobeffect.getAmplifier()); + MobEffectList.byId[mobeffect.getEffectId()].a(this, this.bc(), mobeffect.getAmplifier()); + MobEffectList.byId[mobeffect.getEffectId()].b(this, this.bc(), mobeffect.getAmplifier()); } } protected void b(MobEffect mobeffect) { this.updateEffects = true; if (!this.world.isStatic) { - MobEffectList.byId[mobeffect.getEffectId()].a(this, this.aX(), mobeffect.getAmplifier()); + MobEffectList.byId[mobeffect.getEffectId()].a(this, this.bc(), mobeffect.getAmplifier()); } } @@ -598,7 +617,7 @@ public abstract class EntityLiving extends Entity { public void setHealth(float f) { // CraftBukkit start - Handle scaled health if (this instanceof EntityPlayer) { - org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity(); + org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity(); // Squeeze if (f < 0.0F) { player.setRealHealth(0.0D); @@ -624,7 +643,7 @@ public abstract class EntityLiving extends Entity { this.aV = 0; if (this.getHealth() <= 0.0F) { return false; - } else if (damagesource.m() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) { + } else if (damagesource.o() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) { return false; } else { if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) { @@ -685,7 +704,7 @@ public abstract class EntityLiving extends Entity { if (flag) { this.world.broadcastEntityEffect(this, (byte) 2); if (damagesource != DamageSource.DROWN) { - this.K(); + this.Q(); } if (entity != null) { @@ -704,14 +723,20 @@ public abstract class EntityLiving extends Entity { } } + String s; + if (this.getHealth() <= 0.0F) { - if (flag) { - this.makeSound(this.aP(), this.ba(), this.bb()); + s = this.aU(); + if (flag && s != null) { + this.makeSound(s, this.bf(), this.bg()); } this.die(damagesource); - } else if (flag) { - this.makeSound(this.aO(), this.ba(), this.bb()); + } else { + s = this.aT(); + if (flag && s != null) { + this.makeSound(s, this.bf(), this.bg()); + } } return true; @@ -732,13 +757,13 @@ public abstract class EntityLiving extends Entity { vec3d1.a(-this.pitch * 3.1415927F / 180.0F); vec3d1.b(-this.yaw * 3.1415927F / 180.0F); vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ); - this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e); + this.world.addParticle("iconcrack_" + Item.b(itemstack.getItem()), vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e); } } public void die(DamageSource damagesource) { Entity entity = damagesource.getEntity(); - EntityLiving entityliving = this.aS(); + EntityLiving entityliving = this.aX(); if (this.bb >= 0 && entityliving != null) { entityliving.b(this, this.bb); @@ -756,14 +781,14 @@ public abstract class EntityLiving extends Entity { i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity); } - if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) { + if (this.aG() && this.world.getGameRules().getBoolean("doMobLoot")) { this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i); this.dropEquipment(this.lastDamageByPlayerTime > 0, i); if (false && this.lastDamageByPlayerTime > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot int j = this.random.nextInt(200) - i; if (j < 5) { - this.l(j <= 0 ? 1 : 0); + this.getRareDrop(j <= 0 ? 1 : 0); } } } else { // CraftBukkit @@ -778,7 +803,7 @@ public abstract class EntityLiving extends Entity { public void a(Entity entity, float f, double d0, double d1) { if (this.random.nextDouble() >= this.getAttributeInstance(GenericAttributes.c).getValue()) { - this.an = true; + this.am = true; float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1); float f2 = 0.4F; @@ -794,29 +819,29 @@ public abstract class EntityLiving extends Entity { } } - protected String aO() { - return "damage.hit"; + protected String aT() { + return "game.neutral.hurt"; } - protected String aP() { - return "damage.hit"; + protected String aU() { + return "game.neutral.die"; } // CraftBukkit start - Change return type to ItemStack - protected ItemStack l(int i) { + protected ItemStack getRareDrop(int i) { return null; } // CraftBukkit end protected void dropDeathLoot(boolean flag, int i) {} - public boolean e() { + public boolean h_() { int i = MathHelper.floor(this.locX); int j = MathHelper.floor(this.boundingBox.b); int k = MathHelper.floor(this.locZ); - int l = this.world.getTypeId(i, j, k); + Block block = this.world.getType(i, j, k); - return l == Block.LADDER.id || l == Block.VINE.id; + return block == Blocks.LADDER || block == Blocks.VINE; } public boolean isAlive() { @@ -844,24 +869,26 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end if (i > 0) { - if (i > 4) { - this.makeSound("damage.fallbig", 1.0F, 1.0F); - } else { - this.makeSound("damage.fallsmall", 1.0F, 1.0F); - } - + this.makeSound(this.o(org.bukkit.util.NumberConversions.ceil(i)), 1.0F, 1.0F); // CraftBukkit - ceil this.damageEntity(DamageSource.FALL, (float) i); - int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ)); + int j = MathHelper.floor(this.locX); + int k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height); + int l = MathHelper.floor(this.locZ); + Block block = this.world.getType(j, k, l); - if (j > 0) { - StepSound stepsound = Block.byId[j].stepSound; + if (block.getMaterial() != Material.AIR) { + StepSound stepsound = block.stepSound; this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F); } } } - public int aQ() { + protected String o(int i) { + return i > 4 ? "game.neutral.hurt.fall.big" : "game.neutral.hurt.fall.small"; + } + + public int aV() { int i = 0; ItemStack[] aitemstack = this.getEquipment(); int j = aitemstack.length; @@ -883,7 +910,7 @@ public abstract class EntityLiving extends Entity { protected float b(DamageSource damagesource, float f) { if (!damagesource.ignoresArmor()) { - int i = 25 - this.aQ(); + int i = 25 - this.aV(); float f1 = f * (float) i; this.h(f); @@ -894,36 +921,40 @@ public abstract class EntityLiving extends Entity { } protected float c(DamageSource damagesource, float f) { - if (this instanceof EntityZombie) { - f = f; - } - - int i; - int j; - float f1; - - if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { - i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; - j = 25 - i; - f1 = f * (float) j; - f = f1 / 25.0F; - } - - if (f <= 0.0F) { - return 0.0F; + if (damagesource.h()) { + return f; } else { - i = EnchantmentManager.a(this.getEquipment(), damagesource); - if (i > 20) { - i = 20; + if (this instanceof EntityZombie) { + f = f; } - if (i > 0 && i <= 20) { + int i; + int j; + float f1; + + if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { + i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; j = 25 - i; f1 = f * (float) j; f = f1 / 25.0F; } - return f; + if (f <= 0.0F) { + return 0.0F; + } else { + i = EnchantmentManager.a(this.getEquipment(), damagesource); + if (i > 20) { + i = 20; + } + + if (i > 0 && i <= 20) { + j = 25 - i; + f1 = f * (float) j; + f = f1 / 25.0F; + } + + return f; + } } } @@ -933,23 +964,23 @@ public abstract class EntityLiving extends Entity { f = this.c(damagesource, f); float f1 = f; - f = Math.max(f - this.bn(), 0.0F); - this.m(this.bn() - (f1 - f)); + f = Math.max(f - this.bs(), 0.0F); + this.m(this.bs() - (f1 - f)); if (f != 0.0F) { float f2 = this.getHealth(); this.setHealth(f2 - f); - this.aR().a(damagesource, f2, f); - this.m(this.bn() - f); + this.aW().a(damagesource, f2, f); + this.m(this.bs() - f); } } } - public CombatTracker aR() { + public CombatTracker aW() { return this.combatTracker; } - public EntityLiving aS() { + public EntityLiving aX() { return (EntityLiving) (this.combatTracker.c() != null ? this.combatTracker.c() : (this.killer != null ? this.killer : (this.lastDamager != null ? this.lastDamager : null))); } @@ -957,34 +988,34 @@ public abstract class EntityLiving extends Entity { return (float) this.getAttributeInstance(GenericAttributes.a).getValue(); } - public final int aU() { + public final int aZ() { return this.datawatcher.getByte(9); } - public final void m(int i) { + public final void p(int i) { this.datawatcher.watch(9, Byte.valueOf((byte) i)); } - private int h() { + private int j() { return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6); } - public void aV() { - if (!this.au || this.av >= this.h() / 2 || this.av < 0) { + public void ba() { + if (!this.au || this.av >= this.j() / 2 || this.av < 0) { this.av = -1; this.au = true; if (this.world instanceof WorldServer) { - ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1))); + ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutAnimation(this, 0))); } } } - protected void C() { + protected void G() { this.damageEntity(DamageSource.OUT_OF_WORLD, 4.0F); } - protected void aW() { - int i = this.h(); + protected void bb() { + int i = this.j(); if (this.au) { ++this.av; @@ -1000,10 +1031,10 @@ public abstract class EntityLiving extends Entity { } public AttributeInstance getAttributeInstance(IAttribute iattribute) { - return this.aX().a(iattribute); + return this.bc().a(iattribute); } - public AttributeMapBase aX() { + public AttributeMapBase bc() { if (this.d == null) { this.d = new AttributeMapServer(); } @@ -1015,7 +1046,7 @@ public abstract class EntityLiving extends Entity { return EnumMonsterType.UNDEFINED; } - public abstract ItemStack aZ(); + public abstract ItemStack be(); public abstract ItemStack getEquipment(int i); @@ -1036,15 +1067,15 @@ public abstract class EntityLiving extends Entity { public abstract ItemStack[] getEquipment(); - protected float ba() { + protected float bf() { return 1.0F; } - protected float bb() { + protected float bg() { return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; } - protected boolean bc() { + protected boolean bh() { return this.getHealth() <= 0.0F; } @@ -1056,24 +1087,25 @@ public abstract class EntityLiving extends Entity { double d0 = entity.locX; double d1 = entity.boundingBox.b + (double) entity.length; double d2 = entity.locZ; + byte b0 = 3; - for (double d3 = -1.5D; d3 < 2.0D; ++d3) { - for (double d4 = -1.5D; d4 < 2.0D; ++d4) { - if (d3 != 0.0D || d4 != 0.0D) { - int i = (int) (this.locX + d3); - int j = (int) (this.locZ + d4); - AxisAlignedBB axisalignedbb = this.boundingBox.c(d3, 1.0D, d4); + for (int i = -b0; i <= b0; ++i) { + for (int j = -b0; j < b0; ++j) { + if (i != 0 || j != 0) { + int k = (int) (this.locX + (double) i); + int l = (int) (this.locZ + (double) j); + AxisAlignedBB axisalignedbb = this.boundingBox.c((double) i, 1.0D, (double) j); if (this.world.a(axisalignedbb).isEmpty()) { - if (this.world.w(i, (int) this.locY, j)) { - this.enderTeleportTo(this.locX + d3, this.locY + 1.0D, this.locZ + d4); + if (World.a((IBlockAccess) this.world, k, (int) this.locY, l)) { + this.enderTeleportTo(this.locX + (double) i, this.locY + 1.0D, this.locZ + (double) j); return; } - if (this.world.w(i, (int) this.locY - 1, j) || this.world.getMaterial(i, (int) this.locY - 1, j) == Material.WATER) { - d0 = this.locX + d3; + if (World.a((IBlockAccess) this.world, k, (int) this.locY - 1, l) || this.world.getType(k, (int) this.locY - 1, l).getMaterial() == Material.WATER) { + d0 = this.locX + (double) i; d1 = this.locY + 1.0D; - d2 = this.locZ + d4; + d2 = this.locZ + (double) j; } } } @@ -1083,7 +1115,7 @@ public abstract class EntityLiving extends Entity { this.enderTeleportTo(d0, d1, d2); } - protected void be() { + protected void bj() { this.motY = 0.41999998688697815D; if (this.hasEffect(MobEffectList.JUMP)) { this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F); @@ -1096,15 +1128,15 @@ public abstract class EntityLiving extends Entity { this.motZ += (double) (MathHelper.cos(f) * 0.2F); } - this.an = true; + this.am = true; } public void e(float f, float f1) { double d0; - if (this.H() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { + if (this.M() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { d0 = this.locY; - this.a(f, f1, this.bf() ? 0.04F : 0.02F); + this.a(f, f1, this.bk() ? 0.04F : 0.02F); this.move(this.motX, this.motY, this.motZ); this.motX *= 0.800000011920929D; this.motY *= 0.800000011920929D; @@ -1113,7 +1145,7 @@ public abstract class EntityLiving extends Entity { if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) { this.motY = 0.30000001192092896D; } - } else if (this.J() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { + } else if (this.P() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) { d0 = this.locY; this.a(f, f1, 0.02F); this.move(this.motX, this.motY, this.motZ); @@ -1128,19 +1160,14 @@ public abstract class EntityLiving extends Entity { float f2 = 0.91F; if (this.onGround) { - f2 = 0.54600006F; - int i = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)); - - if (i > 0) { - f2 = Block.byId[i].frictionFactor * 0.91F; - } + f2 = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)).frictionFactor * 0.91F; } float f3 = 0.16277136F / (f2 * f2 * f2); float f4; if (this.onGround) { - f4 = this.bg() * f3; + f4 = this.bl() * f3; } else { f4 = this.aR; } @@ -1148,15 +1175,10 @@ public abstract class EntityLiving extends Entity { this.a(f, f1, f4); f2 = 0.91F; if (this.onGround) { - f2 = 0.54600006F; - int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)); - - if (j > 0) { - f2 = Block.byId[j].frictionFactor * 0.91F; - } + f2 = this.world.getType(MathHelper.floor(this.locX), MathHelper.floor(this.boundingBox.b) - 1, MathHelper.floor(this.locZ)).frictionFactor * 0.91F; } - if (this.e()) { + if (this.h_()) { float f5 = 0.15F; if (this.motX < (double) (-f5)) { @@ -1188,7 +1210,7 @@ public abstract class EntityLiving extends Entity { } this.move(this.motX, this.motY, this.motZ); - if (this.positionChanged && this.e()) { + if (this.positionChanged && this.h_()) { this.motY = 0.2D; } @@ -1220,12 +1242,12 @@ public abstract class EntityLiving extends Entity { this.aH += this.aG; } - protected boolean bf() { + protected boolean bk() { return false; } - public float bg() { - return this.bf() ? this.bp : 0.1F; + public float bl() { + return this.bk() ? this.bp : 0.1F; } public void i(float f) { @@ -1241,10 +1263,10 @@ public abstract class EntityLiving extends Entity { return false; } - public void l_() { - super.l_(); + public void h() { + super.h(); if (!this.world.isStatic) { - int i = this.aU(); + int i = this.aZ(); if (i > 0) { if (this.aw <= 0) { @@ -1253,7 +1275,7 @@ public abstract class EntityLiving extends Entity { --this.aw; if (this.aw <= 0) { - this.m(i - 1); + this.p(i - 1); } } @@ -1262,7 +1284,7 @@ public abstract class EntityLiving extends Entity { ItemStack itemstack1 = this.getEquipment(j); if (!ItemStack.matches(itemstack1, itemstack)) { - ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, j, itemstack1))); + ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new PacketPlayOutEntityEquipment(this.getId(), j, itemstack1))); if (itemstack != null) { this.d.a(itemstack.D()); } @@ -1276,7 +1298,7 @@ public abstract class EntityLiving extends Entity { } } - this.c(); + this.e(); double d0 = this.locX - this.lastX; double d1 = this.locZ - this.lastZ; float f = (float) (d0 * d0 + d1 * d1); @@ -1290,7 +1312,7 @@ public abstract class EntityLiving extends Entity { f3 = 1.0F; f2 = (float) Math.sqrt((double) f) * 3.0F; // CraftBukkit - Math -> TrigMath - f1 = (float) org.bukkit.craftbukkit.v1_6_R3.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; + f1 = (float) org.bukkit.craftbukkit.v1_7_R1.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; } if (this.aE > 0.0F) { @@ -1370,7 +1392,7 @@ public abstract class EntityLiving extends Entity { return f1; } - public void c() { + public void e() { if (this.bq > 0) { --this.bq; } @@ -1386,7 +1408,7 @@ public abstract class EntityLiving extends Entity { --this.bh; this.setPosition(d0, d1, d2); this.b(this.yaw, this.pitch); - } else if (!this.bm()) { + } else if (!this.br()) { this.motX *= 0.98D; this.motY *= 0.98D; this.motZ *= 0.98D; @@ -1405,19 +1427,19 @@ public abstract class EntityLiving extends Entity { } this.world.methodProfiler.a("ai"); - if (this.bc()) { + if (this.bh()) { this.bd = false; this.be = 0.0F; this.bf = 0.0F; this.bg = 0.0F; - } else if (this.bm()) { - if (this.bf()) { + } else if (this.br()) { + if (this.bk()) { this.world.methodProfiler.a("newAi"); - this.bi(); + this.bn(); this.world.methodProfiler.b(); } else { this.world.methodProfiler.a("oldAi"); - this.bl(); + this.bq(); this.world.methodProfiler.b(); this.aP = this.yaw; } @@ -1426,9 +1448,9 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); this.world.methodProfiler.a("jump"); if (this.bd) { - if (!this.H() && !this.J()) { + if (!this.M() && !this.P()) { if (this.onGround && this.bq == 0) { - this.be(); + this.bj(); this.bq = 10; } } else { @@ -1447,15 +1469,15 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); this.world.methodProfiler.a("push"); if (!this.world.isStatic) { - this.bj(); + this.bo(); } this.world.methodProfiler.b(); } - protected void bi() {} + protected void bn() {} - protected void bj() { + protected void bo() { List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); if (list != null && !list.isEmpty()) { @@ -1469,7 +1491,7 @@ public abstract class EntityLiving extends Entity { } // CraftBukkit end - if (entity.M() && M()) { + if (entity.S() && S()) { this.n(entity); } } @@ -1480,16 +1502,16 @@ public abstract class EntityLiving extends Entity { entity.collide(this); } - public void V() { - super.V(); + public void ab() { + super.ab(); this.aW = this.aX; this.aX = 0.0F; this.fallDistance = 0.0F; } - protected void bk() {} + protected void bp() {} - protected void bl() { + protected void bq() { ++this.aV; } @@ -1502,15 +1524,15 @@ public abstract class EntityLiving extends Entity { EntityTracker entitytracker = ((WorldServer) this.world).getTracker(); if (entity instanceof EntityItem) { - entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id))); + entitytracker.a(entity, (Packet) (new PacketPlayOutCollect(entity.getId(), this.getId()))); } if (entity instanceof EntityArrow) { - entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id))); + entitytracker.a(entity, (Packet) (new PacketPlayOutCollect(entity.getId(), this.getId()))); } if (entity instanceof EntityExperienceOrb) { - entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id))); + entitytracker.a(entity, (Packet) (new PacketPlayOutCollect(entity.getId(), this.getId()))); } } } @@ -1519,7 +1541,7 @@ public abstract class EntityLiving extends Entity { return this.world.a(this.world.getVec3DPool().create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), this.world.getVec3DPool().create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null; } - public Vec3D aa() { + public Vec3D ag() { return this.j(1.0F); } @@ -1547,15 +1569,15 @@ public abstract class EntityLiving extends Entity { } } - public boolean bm() { + public boolean br() { return !this.world.isStatic; } - public boolean L() { + public boolean R() { return !this.dead; } - public boolean M() { + public boolean S() { return !ghost && !this.dead; } @@ -1563,7 +1585,7 @@ public abstract class EntityLiving extends Entity { return this.length * 0.85F; } - protected void K() { + protected void Q() { this.velocityChanged = this.random.nextDouble() >= this.getAttributeInstance(GenericAttributes.c).getValue(); } @@ -1571,7 +1593,7 @@ public abstract class EntityLiving extends Entity { return this.aP; } - public float bn() { + public float bs() { return this.br; } @@ -1594,4 +1616,4 @@ public abstract class EntityLiving extends Entity { public boolean a(ScoreboardTeamBase scoreboardteambase) { return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false; } -} \ No newline at end of file +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityPlayer.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityPlayer.java similarity index 63% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityPlayer.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityPlayer.java index 93532cc35..7857c0ede 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntityPlayer.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityPlayer.java @@ -1,133 +1,54 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; -import java.io.ByteArrayOutputStream; -import java.io.DataOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import net.minecraft.server.v1_6_R3.AchievementList; -import net.minecraft.server.v1_6_R3.ChatMessage; -import net.minecraft.server.v1_6_R3.Chunk; -import net.minecraft.server.v1_6_R3.ChunkCoordIntPair; -import net.minecraft.server.v1_6_R3.ChunkCoordinates; -import net.minecraft.server.v1_6_R3.CombatTracker; -import net.minecraft.server.v1_6_R3.Container; -import net.minecraft.server.v1_6_R3.ContainerAnvil; -import net.minecraft.server.v1_6_R3.ContainerBeacon; -import net.minecraft.server.v1_6_R3.ContainerBrewingStand; -import net.minecraft.server.v1_6_R3.ContainerChest; -import net.minecraft.server.v1_6_R3.ContainerDispenser; -import net.minecraft.server.v1_6_R3.ContainerEnchantTable; -import net.minecraft.server.v1_6_R3.ContainerFurnace; -import net.minecraft.server.v1_6_R3.ContainerHopper; -import net.minecraft.server.v1_6_R3.ContainerHorse; -import net.minecraft.server.v1_6_R3.ContainerMerchant; -import net.minecraft.server.v1_6_R3.ContainerWorkbench; -import net.minecraft.server.v1_6_R3.CrashReport; -import net.minecraft.server.v1_6_R3.CrashReportSystemDetails; -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityArrow; -import net.minecraft.server.v1_6_R3.EntityDamageSource; -import net.minecraft.server.v1_6_R3.EntityHorse; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.EntityMinecartHopper; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EnumAnimation; -import net.minecraft.server.v1_6_R3.EnumBedResult; -import net.minecraft.server.v1_6_R3.EnumGamemode; -import net.minecraft.server.v1_6_R3.FoodMetaData; -import net.minecraft.server.v1_6_R3.ICrafting; -import net.minecraft.server.v1_6_R3.IInventory; -import net.minecraft.server.v1_6_R3.IMerchant; -import net.minecraft.server.v1_6_R3.IScoreboardCriteria; -import net.minecraft.server.v1_6_R3.InventoryMerchant; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.ItemStack; -import net.minecraft.server.v1_6_R3.ItemWorldMapBase; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.MerchantRecipeList; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.MobEffect; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet100OpenWindow; -import net.minecraft.server.v1_6_R3.Packet101CloseWindow; -import net.minecraft.server.v1_6_R3.Packet103SetSlot; -import net.minecraft.server.v1_6_R3.Packet104WindowItems; -import net.minecraft.server.v1_6_R3.Packet105CraftProgressBar; -import net.minecraft.server.v1_6_R3.Packet133OpenTileEntity; -import net.minecraft.server.v1_6_R3.Packet17EntityLocationAction; -import net.minecraft.server.v1_6_R3.Packet18ArmAnimation; -import net.minecraft.server.v1_6_R3.Packet200Statistic; -import net.minecraft.server.v1_6_R3.Packet202Abilities; -import net.minecraft.server.v1_6_R3.Packet204LocaleAndViewDistance; -import net.minecraft.server.v1_6_R3.Packet250CustomPayload; -import net.minecraft.server.v1_6_R3.Packet29DestroyEntity; -import net.minecraft.server.v1_6_R3.Packet38EntityStatus; -import net.minecraft.server.v1_6_R3.Packet39AttachEntity; -import net.minecraft.server.v1_6_R3.Packet3Chat; -import net.minecraft.server.v1_6_R3.Packet41MobEffect; -import net.minecraft.server.v1_6_R3.Packet42RemoveMobEffect; -import net.minecraft.server.v1_6_R3.Packet43SetExperience; -import net.minecraft.server.v1_6_R3.Packet56MapChunkBulk; -import net.minecraft.server.v1_6_R3.Packet70Bed; -import net.minecraft.server.v1_6_R3.Packet8UpdateHealth; -import net.minecraft.server.v1_6_R3.PlayerConnection; -import net.minecraft.server.v1_6_R3.PlayerInteractManager; -import net.minecraft.server.v1_6_R3.ReportedException; -import net.minecraft.server.v1_6_R3.ScoreboardScore; -import net.minecraft.server.v1_6_R3.SlotResult; -import net.minecraft.server.v1_6_R3.Statistic; -import net.minecraft.server.v1_6_R3.StatisticList; -import net.minecraft.server.v1_6_R3.TileEntity; -import net.minecraft.server.v1_6_R3.TileEntityBeacon; -import net.minecraft.server.v1_6_R3.TileEntityBrewingStand; -import net.minecraft.server.v1_6_R3.TileEntityDispenser; -import net.minecraft.server.v1_6_R3.TileEntityDropper; -import net.minecraft.server.v1_6_R3.TileEntityFurnace; -import net.minecraft.server.v1_6_R3.TileEntityHopper; -import net.minecraft.server.v1_6_R3.TileEntitySign; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldServer; +import net.minecraft.util.com.google.common.collect.Sets; +import net.minecraft.util.com.mojang.authlib.GameProfile; +import net.minecraft.util.io.netty.buffer.Unpooled; +import net.minecraft.util.org.apache.commons.io.Charsets; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; // CraftBukkit start import org.bukkit.Bukkit; import org.bukkit.WeatherType; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; // CraftBukkit end public class EntityPlayer extends EntityHuman implements ICrafting { + private static final Logger bM = LogManager.getLogger(); private String locale = "en_US"; public PlayerConnection playerConnection; - public MinecraftServer server; - public PlayerInteractManager playerInteractManager; + public final MinecraftServer server; + public final PlayerInteractManager playerInteractManager; public double d; public double e; public final List chunkCoordIntPairQueue = new LinkedList(); public final List removeQueue = new LinkedList(); - private float bO = Float.MIN_VALUE; - private float bP = -1.0E8F; - private int bQ = -99999999; - private boolean bR = true; + private final ServerStatisticManager bO; + private float bP = Float.MIN_VALUE; + private float bQ = -1.0E8F; + private int bR = -99999999; + private boolean bS = true; public int lastSentExp = -99999999; // CraftBukkit - private -> public public int invulnerableTicks = 60; // CraftBukkit - private -> public - private int bU; private int bV; - private boolean bW = true; - private long bX = 0L; + private EnumChatVisibility bW; + private boolean bX = true; + private long bY = 0L; private int containerCounter; public boolean h; public int ping; @@ -142,39 +63,40 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean keepLevel = false; public double maxHealthCache; // CraftBukkit end - - public boolean spectating; - public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) { - super(world, s); + public boolean spectating; // Mineplex + + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, gameprofile); playerinteractmanager.player = this; this.playerInteractManager = playerinteractmanager; - this.bU = minecraftserver.getPlayerList().o(); - ChunkCoordinates chunkcoordinates = world.getSpawn(); + this.bV = minecraftserver.getPlayerList().o(); + ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); int i = chunkcoordinates.x; int j = chunkcoordinates.z; int k = chunkcoordinates.y; - if (!world.worldProvider.g && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) { + if (!worldserver.worldProvider.g && worldserver.getWorldData().getGameType() != EnumGamemode.ADVENTURE) { int l = Math.max(5, minecraftserver.getSpawnProtection() - 6); i += this.random.nextInt(l * 2) - l; j += this.random.nextInt(l * 2) - l; - k = world.i(i, j); + k = worldserver.i(i, j); } this.server = minecraftserver; - this.Y = 0.0F; + this.bO = minecraftserver.getPlayerList().i(this.getName()); + this.X = 0.0F; this.height = 0.0F; this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F); - while (!world.getCubes(this, this.boundingBox).isEmpty()) { + while (!worldserver.getCubes(this, this.boundingBox).isEmpty()) { this.setPosition(this.locX, this.locY + 1.0D, this.locZ); } // CraftBukkit start - this.displayName = this.name; - this.listName = this.name; + this.displayName = this.getName(); + this.listName = this.getName(); // this.canPickUpLoot = true; TODO this.maxHealthCache = this.getMaxHealth(); // CraftBukkit end @@ -182,7 +104,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - if (nbttagcompound.hasKey("playerGameType")) { + if (nbttagcompound.hasKeyOfType("playerGameType", 99)) { if (MinecraftServer.getServer().getForceGamemode()) { this.playerInteractManager.setGameMode(MinecraftServer.getServer().getGamemode()); } else { @@ -232,7 +154,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.activeContainer.addSlotListener(this); } - protected void d_() { + protected void e_() { this.height = 0.0F; } @@ -240,21 +162,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return 1.62F; } - public void l_() { + public void h() { this.playerInteractManager.a(); --this.invulnerableTicks; + if (this.noDamageTicks > 0) { + --this.noDamageTicks; + } + this.activeContainer.b(); if (!this.world.isStatic && !this.activeContainer.a((EntityHuman) this)) { this.closeInventory(); this.activeContainer = this.defaultContainer; } - // CraftBukkit start - if (this.noDamageTicks > 0) { - --this.noDamageTicks; - } - // CraftBukkit end - while (!this.removeQueue.isEmpty()) { int i = Math.min(this.removeQueue.size(), 127); int[] aint = new int[i]; @@ -266,7 +186,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { iterator.remove(); } - this.playerConnection.sendPacket(new Packet29DestroyEntity(aint)); + this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint)); } if (!this.chunkCoordIntPairQueue.isEmpty()) { @@ -274,21 +194,27 @@ public class EntityPlayer extends EntityHuman implements ICrafting { Iterator iterator1 = this.chunkCoordIntPairQueue.iterator(); ArrayList arraylist1 = new ArrayList(); - while (iterator1.hasNext() && arraylist.size() < 5) { + Chunk chunk; + + while (iterator1.hasNext() && arraylist.size() < PacketPlayOutMapChunkBulk.c()) { ChunkCoordIntPair chunkcoordintpair = (ChunkCoordIntPair) iterator1.next(); - iterator1.remove(); - if (chunkcoordintpair != null && this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) { - // CraftBukkit start - Get tile entities directly from the chunk instead of the world - Chunk chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); - arraylist.add(chunk); - arraylist1.addAll(chunk.tileEntities.values()); - // CraftBukkit end + if (chunkcoordintpair != null) { + if (this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) { + chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); + if (chunk.k()) { + arraylist.add(chunk); + arraylist1.addAll(chunk.tileEntities.values()); // CraftBukkit - Get tile entities directly from the chunk instead of the world + iterator1.remove(); + } + } + } else { + iterator1.remove(); } } if (!arraylist.isEmpty()) { - this.playerConnection.sendPacket(new Packet56MapChunkBulk(arraylist)); + this.playerConnection.sendPacket(new PacketPlayOutMapChunkBulk(arraylist)); Iterator iterator2 = arraylist1.iterator(); while (iterator2.hasNext()) { @@ -300,27 +226,26 @@ public class EntityPlayer extends EntityHuman implements ICrafting { iterator2 = arraylist.iterator(); while (iterator2.hasNext()) { - Chunk chunk = (Chunk) iterator2.next(); - - this.p().getTracker().a(this, chunk); + chunk = (Chunk) iterator2.next(); + this.r().getTracker().a(this, chunk); } } - - if (this.bX > 0L && this.server.ar() > 0 && MinecraftServer.aq() - this.bX > (long) (this.server.ar() * 1000 * 60)) { - this.playerConnection.disconnect("You have been idle for too long!"); - } + } + + if (this.bY > 0L && this.server.aq() > 0 && MinecraftServer.ap() - this.bY > (long) (this.server.aq() * 1000 * 60)) { + this.playerConnection.disconnect("You have been idle for too long!"); } } - public void h() { + public void i() { try { - super.l_(); + super.h(); for (int i = 0; i < this.inventory.getSize(); ++i) { ItemStack itemstack = this.inventory.getItem(i); - if (itemstack != null && Item.byId[itemstack.id].f() && this.playerConnection.lowPriorityCount() <= 5) { - Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this); + if (itemstack != null && itemstack.getItem().h()) { + Packet packet = ((ItemWorldMapBase) itemstack.getItem()).c(itemstack, this.world, this); if (packet != null) { this.playerConnection.sendPacket(packet); @@ -328,28 +253,33 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - if (this.getHealth() != this.bP || this.bQ != this.foodData.a() || this.foodData.e() == 0.0F != this.bR) { - // CraftBukkit - this.getHealth() -> this.getScaledHealth() - this.playerConnection.sendPacket(new Packet8UpdateHealth(getBukkitEntity().getScaledHealth(), this.foodData.a(), this.foodData.e())); - this.bP = this.getHealth(); - this.bQ = this.foodData.a(); - this.bR = this.foodData.e() == 0.0F; + // CraftBukkit - Optionally scale health + if (this.getHealth() != this.bQ || this.bR != this.foodData.a() || this.foodData.e() == 0.0F != this.bS) { + this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.a(), this.foodData.e())); + this.bQ = this.getHealth(); + this.bR = this.foodData.a(); + this.bS = this.foodData.e() == 0.0F; } - if (this.getHealth() + this.bn() != this.bO) { - this.bO = this.getHealth() + this.bn(); + if (this.getHealth() + this.bs() != this.bP) { + this.bP = this.getHealth() + this.bs(); // CraftBukkit - Update ALL the scores! - this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getLocalizedName(), com.google.common.collect.ImmutableList.of(this)); + this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getName(), com.google.common.collect.ImmutableList.of(this)); } - + // CraftBukkit start - Force max health updates if (this.maxHealthCache != this.getMaxHealth()) { - this.getBukkitEntity().updateScaledHealth(); + this.getBukkitEntity().updateScaledHealth(); } + // CraftBukkit end if (this.expTotal != this.lastSentExp) { this.lastSentExp = this.expTotal; - this.playerConnection.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel)); + this.playerConnection.sendPacket(new PacketPlayOutExperience(this.exp, this.expTotal, this.expLevel)); + } + + if (this.ticksLived % 20 * 5 == 0 && !this.x().a(AchievementList.L)) { + this.j(); } // CraftBukkit start @@ -371,6 +301,46 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } + protected void j() { + BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); + + if (biomebase != null) { + String s = biomebase.af; + AchievementSet achievementset = (AchievementSet) this.x().b((Statistic) AchievementList.L); // CraftBukkit - fix decompile error + + if (achievementset == null) { + achievementset = (AchievementSet) this.x().a(AchievementList.L, new AchievementSet()); + } + + achievementset.add(s); + if (this.x().b(AchievementList.L) && achievementset.size() == BiomeBase.n.size()) { + HashSet hashset = Sets.newHashSet(BiomeBase.n); + Iterator iterator = achievementset.iterator(); + + while (iterator.hasNext()) { + String s1 = (String) iterator.next(); + Iterator iterator1 = hashset.iterator(); + + while (iterator1.hasNext()) { + BiomeBase biomebase1 = (BiomeBase) iterator1.next(); + + if (biomebase1.af.equals(s1)) { + iterator1.remove(); + } + } + + if (hashset.isEmpty()) { + break; + } + } + + if (hashset.isEmpty()) { + this.a((Statistic) AchievementList.L); + } + } + } + } + public void die(DamageSource damagesource) { // CraftBukkit start if (this.dead) { @@ -394,22 +364,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } - ChatMessage chatmessage = this.aR().b(); + IChatBaseComponent chatmessage = this.aW().b(); - String deathmessage = chatmessage.toString(); + String deathmessage = chatmessage.c(); org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage); String deathMessage = event.getDeathMessage(); if (deathMessage != null && deathMessage.length() > 0) { - if (deathMessage.equals(chatmessage.toString())) { + if (deathMessage.equals(deathmessage)) { this.server.getPlayerList().sendMessage(chatmessage); } else { - this.server.getPlayerList().sendMessage(ChatMessage.d(event.getDeathMessage())); + this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage.fromString(deathMessage)); } } - // CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. + // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. if (!keepInventory) { for (int i = 0; i < this.inventory.items.length; ++i) { this.inventory.items[i] = null; @@ -424,7 +394,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end // CraftBukkit - Get our scores instead - Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.c, this.getLocalizedName(), new java.util.ArrayList()); + Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.c, this.getName(), new java.util.ArrayList()); Iterator iterator = collection.iterator(); while (iterator.hasNext()) { @@ -433,13 +403,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { scoreboardscore.incrementScore(); } - EntityLiving entityliving = this.aS(); + EntityLiving entityliving = this.aX(); if (entityliving != null) { + int i = EntityTypes.a(entityliving); + MonsterEggInfo monsteregginfo = (MonsterEggInfo) EntityTypes.a.get(Integer.valueOf(i)); + + if (monsteregginfo != null) { + this.a(monsteregginfo.e, 1); + } + entityliving.b(this, this.bb); } - this.a(StatisticList.y, 1); + this.a(StatisticList.v, 1); } public boolean damageEntity(DamageSource damagesource, float f) { @@ -480,13 +457,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void b(int i) { if (this.dimension == 1 && i == 1) { - this.a((Statistic) AchievementList.C); + this.a((Statistic) AchievementList.D); this.world.kill(this); this.viewingCredits = true; - this.playerConnection.sendPacket(new Packet70Bed(4, 0)); + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(4, 0.0F)); } else { if (this.dimension == 0 && i == 1) { - this.a((Statistic) AchievementList.B); + this.a((Statistic) AchievementList.C); // CraftBukkit start - Rely on custom portal management /* ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn(); @@ -499,21 +476,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { */ // CraftBukkit end } else { - this.a((Statistic) AchievementList.x); + this.a((Statistic) AchievementList.y); } - + // CraftBukkit start TeleportCause cause = (this.dimension == 1 || i == 1) ? TeleportCause.END_PORTAL : TeleportCause.NETHER_PORTAL; - if (dimension == -1 && i == 0) i = 4; this.server.getPlayerList().changeDimension(this, i, cause); // CraftBukkit end this.lastSentExp = -1; - this.bP = -1.0F; - this.bQ = -1; + this.bQ = -1.0F; + this.bR = -1; } } @@ -536,11 +512,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { EnumBedResult enumbedresult = super.a(i, j, k); if (enumbedresult == EnumBedResult.OK) { - Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k); + PacketPlayOutBed packetplayoutbed = new PacketPlayOutBed(this, i, j, k); - this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction); + this.r().getTracker().a((Entity) this, (Packet) packetplayoutbed); this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); - this.playerConnection.sendPacket(packet17entitylocationaction); + this.playerConnection.sendPacket(packetplayoutbed); } return enumbedresult; @@ -550,7 +526,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one! if (this.isSleeping()) { - this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3)); + this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2)); } super.a(flag, flag1, flag2); @@ -567,16 +543,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void setPassengerOf(Entity entity) { // mount(null) doesn't really fly for overloaded methods, // so this method is needed - Entity currentVehicle = this.vehicle; + Entity currentVehicle = this.vehicle; super.setPassengerOf(entity); - // CraftBukkit end - // Check if the vehicle actually changed. + // Check if the vehicle actually changed. if (currentVehicle != this.vehicle) { - this.playerConnection.sendPacket(new Packet39AttachEntity(0, this, this.vehicle)); + this.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this, this.vehicle)); this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); } + // CraftBukkit end } protected void a(double d0, boolean flag) {} @@ -584,12 +560,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void b(double d0, boolean flag) { super.a(d0, flag); } - + public void a(TileEntity tileentity) { - if (tileentity instanceof TileEntitySign) { - ((TileEntitySign) tileentity).a((EntityHuman)this); - this.playerConnection.sendPacket(new Packet133OpenTileEntity(0, tileentity.x, tileentity.y, tileentity.z)); - } + if (tileentity instanceof TileEntitySign) { + ((TileEntitySign) tileentity).a((EntityHuman) this); + this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentity.x, tileentity.y, tileentity.z)); + } } public int nextContainerCounter() { // CraftBukkit - private void -> public int @@ -604,7 +580,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9, true)); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 1, "Crafting", 9, true)); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -617,7 +593,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null)); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null)); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -630,7 +606,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9, true)); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 8, "Repairing", 9, true)); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -647,7 +623,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize(), iinventory.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 0, iinventory.getInventoryName(), iinventory.getSize(), iinventory.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -660,7 +636,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, tileentityhopper.getName(), tileentityhopper.getSize(), tileentityhopper.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 9, tileentityhopper.getInventoryName(), tileentityhopper.getSize(), tileentityhopper.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -673,7 +649,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, entityminecarthopper.getName(), entityminecarthopper.getSize(), entityminecarthopper.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 9, entityminecarthopper.getInventoryName(), entityminecarthopper.getSize(), entityminecarthopper.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -686,7 +662,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize(), tileentityfurnace.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 2, tileentityfurnace.getInventoryName(), tileentityfurnace.getSize(), tileentityfurnace.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -699,7 +675,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, tileentitydispenser instanceof TileEntityDropper ? 10 : 3, tileentitydispenser.getName(), tileentitydispenser.getSize(), tileentitydispenser.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, tileentitydispenser instanceof TileEntityDropper ? 10 : 3, tileentitydispenser.getInventoryName(), tileentitydispenser.getSize(), tileentitydispenser.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -712,7 +688,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize(), tileentitybrewingstand.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 5, tileentitybrewingstand.getInventoryName(), tileentitybrewingstand.getSize(), tileentitybrewingstand.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -725,7 +701,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize(), tileentitybeacon.c())); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 7, tileentitybeacon.getInventoryName(), tileentitybeacon.getSize(), tileentitybeacon.k_())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -743,19 +719,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.activeContainer.addSlotListener(this); InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null)); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null)); MerchantRecipeList merchantrecipelist = imerchant.getOffers(this); if (merchantrecipelist != null) { try { - ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream(); - DataOutputStream dataoutputstream = new DataOutputStream(bytearrayoutputstream); + PacketDataSerializer packetdataserializer = new PacketDataSerializer(Unpooled.buffer()); - dataoutputstream.writeInt(this.containerCounter); - merchantrecipelist.a(dataoutputstream); - this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TrList", bytearrayoutputstream.toByteArray())); - } catch (IOException ioexception) { - ioexception.printStackTrace(); + packetdataserializer.writeInt(this.containerCounter); + merchantrecipelist.a(packetdataserializer); + this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|TrList", packetdataserializer)); + } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception + bM.error("Couldn\'t send trade list", ioexception); } } } @@ -771,7 +746,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } this.nextContainerCounter(); - this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 11, iinventory.getName(), iinventory.getSize(), iinventory.c(), entityhorse.id)); + this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, 11, iinventory.getInventoryName(), iinventory.getSize(), iinventory.k_(), entityhorse.getId())); this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); @@ -780,7 +755,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(Container container, int i, ItemStack itemstack) { if (!(container.getSlot(i) instanceof SlotResult)) { if (!this.h) { - this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack)); + this.playerConnection.sendPacket(new PacketPlayOutSetSlot(container.windowId, i, itemstack)); } } } @@ -790,32 +765,32 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void a(Container container, List list) { - this.playerConnection.sendPacket(new Packet104WindowItems(container.windowId, list)); - this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried())); + this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, list)); + this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); // CraftBukkit start - Send a Set Slot to update the crafting result slot if (java.util.EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) { - this.playerConnection.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem())); + this.playerConnection.sendPacket(new PacketPlayOutSetSlot(container.windowId, 0, container.getSlot(0).getItem())); } // CraftBukkit end } public void setContainerData(Container container, int i, int j) { - this.playerConnection.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j)); + this.playerConnection.sendPacket(new PacketPlayOutCraftProgressBar(container.windowId, i, j)); } public void closeInventory() { CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit - this.playerConnection.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId)); - this.k(); + this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); + this.m(); } public void broadcastCarriedItem() { if (!this.h) { - this.playerConnection.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried())); + this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); } } - public void k() { + public void m() { this.activeContainer.b((EntityHuman) this); this.activeContainer = this.defaultContainer; } @@ -837,13 +812,22 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(Statistic statistic, int i) { if (statistic != null) { - if (!statistic.f) { - this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, i)); + this.bO.b(this, statistic, i); + Iterator iterator = this.getScoreboard().getObjectivesForCriteria(statistic.k()).iterator(); + + while (iterator.hasNext()) { + ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next(); + + this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).incrementScore(); + } + + if (this.bO.e()) { + this.bO.a(this); } } } - public void l() { + public void n() { if (this.passenger != null) { this.passenger.mount(this); } @@ -854,53 +838,53 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } @Override - public boolean L() + public boolean R() { return !spectating; } public void triggerHealthUpdate() { - this.bP = -1.0E8F; + this.bQ = -1.0E8F; this.lastSentExp = -1; // CraftBukkit - Added to reset } - public void a(String s) { - this.playerConnection.sendPacket(new Packet3Chat(ChatMessage.e(s))); + public void b(IChatBaseComponent ichatbasecomponent) { + this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent)); } - protected void n() { - this.playerConnection.sendPacket(new Packet38EntityStatus(this.id, (byte) 9)); - super.n(); + protected void p() { + this.playerConnection.sendPacket(new PacketPlayOutEntityStatus(this, (byte) 9)); + super.p(); } public void a(ItemStack itemstack, int i) { super.a(itemstack, i); - if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().c_(itemstack) == EnumAnimation.EAT) { - this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5)); + if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().d(itemstack) == EnumAnimation.EAT) { + this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 3)); } } public void copyTo(EntityHuman entityhuman, boolean flag) { super.copyTo(entityhuman, flag); this.lastSentExp = -1; - this.bP = -1.0F; - this.bQ = -1; + this.bQ = -1.0F; + this.bR = -1; this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue); } protected void a(MobEffect mobeffect) { super.a(mobeffect); - this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect)); + this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect)); } protected void a(MobEffect mobeffect, boolean flag) { super.a(mobeffect, flag); - this.playerConnection.sendPacket(new Packet41MobEffect(this.id, mobeffect)); + this.playerConnection.sendPacket(new PacketPlayOutEntityEffect(this.getId(), mobeffect)); } protected void b(MobEffect mobeffect) { super.b(mobeffect); - this.playerConnection.sendPacket(new Packet42RemoveMobEffect(this.id, mobeffect)); + this.playerConnection.sendPacket(new PacketPlayOutRemoveEntityEffect(this.getId(), mobeffect)); } public void enderTeleportTo(double d0, double d1, double d2) { @@ -908,37 +892,45 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void b(Entity entity) { - this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6)); + this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 4)); } public void c(Entity entity) { - this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7)); + this.r().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(entity, 5)); } public void updateAbilities() { if (this.playerConnection != null) { - this.playerConnection.sendPacket(new Packet202Abilities(this.abilities)); + this.playerConnection.sendPacket(new PacketPlayOutAbilities(this.abilities)); } } - public WorldServer p() { + public WorldServer r() { return (WorldServer) this.world; } public void a(EnumGamemode enumgamemode) { this.playerInteractManager.setGameMode(enumgamemode); - this.playerConnection.sendPacket(new Packet70Bed(3, enumgamemode.a())); + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.a())); } - public void sendMessage(ChatMessage chatmessage) { - this.playerConnection.sendPacket(new Packet3Chat(chatmessage)); + // CraftBukkit start - Support multi-line messages + public void sendMessage(IChatBaseComponent[] ichatbasecomponent) { + for (IChatBaseComponent component : ichatbasecomponent) { + this.sendMessage(component); + } + } + // CraftBukkit end + + public void sendMessage(IChatBaseComponent ichatbasecomponent) { + this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent)); } public boolean a(int i, String s) { - return "seed".equals(s) && !this.server.V() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? (this.server.getPlayerList().isOp(this.name) ? this.server.k() >= i : false) : true); + return "seed".equals(s) && !this.server.V() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? (this.server.getPlayerList().isOp(this.getName()) ? this.server.l() >= i : false) : true); } - public String q() { + public String s() { String s = this.playerConnection.networkManager.getSocketAddress().toString(); s = s.substring(s.indexOf("/") + 1); @@ -946,41 +938,43 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return s; } - public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) { - this.locale = packet204localeandviewdistance.d(); - int i = 256 >> packet204localeandviewdistance.f(); + public void a(PacketPlayInSettings packetplayinsettings) { + this.locale = packetplayinsettings.c(); + int i = 256 >> packetplayinsettings.d(); if (i > 3 && i < 15) { - this.bU = i; + this.bV = i; } - this.bV = packet204localeandviewdistance.g(); - this.bW = packet204localeandviewdistance.h(); - if (this.server.K() && this.server.J().equals(this.name)) { - this.server.c(packet204localeandviewdistance.i()); + this.bW = packetplayinsettings.e(); + this.bX = packetplayinsettings.f(); + if (this.server.L() && this.server.K().equals(this.getName())) { + this.server.a(packetplayinsettings.g()); } - this.b(1, !packet204localeandviewdistance.j()); + this.b(1, !packetplayinsettings.h()); } - public int getChatFlags() { - return this.bV; + public EnumChatVisibility getChatFlags() { + return this.bW; } - public void a(String s, int i) { - String s1 = s + "\0" + i; // CraftBukkit - fix decompile error - - this.playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", s1.getBytes())); + public void a(String s) { + this.playerConnection.sendPacket(new PacketPlayOutCustomPayload("MC|RPack", s.getBytes(Charsets.UTF_8))); } - public ChunkCoordinates b() { + public ChunkCoordinates getChunkCoordinates() { return new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY + 0.5D), MathHelper.floor(this.locZ)); } - public void u() { - this.bX = MinecraftServer.aq(); + public void w() { + this.bY = MinecraftServer.ap(); } - + + public ServerStatisticManager x() { + return this.bO; + } + // CraftBukkit start public long timeOffset = 0; public boolean relativeTime = true; @@ -1010,7 +1004,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.weather = type; } - this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0)); + if (type == WeatherType.DOWNFALL) { + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(2, 0)); + // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, this.world.j(1.0F))); + // this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, this.world.h(1.0F))); + } else { + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0)); + } } public void resetPlayerWeather() { @@ -1020,7 +1020,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public String toString() { - return super.toString() + "(" + this.name + " at " + this.locX + "," + this.locY + "," + this.locZ + ")"; + return super.toString() + "(" + this.getName() + " at " + this.locX + "," + this.locY + "," + this.locZ + ")"; } public void reset() { @@ -1036,12 +1036,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.setHealth(this.getMaxHealth()); this.fireTicks = 0; this.fallDistance = 0; - this.foodData = new FoodMetaData(); + this.foodData = new FoodMetaData(this); this.expLevel = this.newLevel; this.expTotal = this.newTotalExp; this.exp = 0; this.deathTicks = 0; - this.aJ(); + this.aP(); // Should be remapped: removeAllEffects should be remapped to this. this.updateEffects = true; this.activeContainer = this.defaultContainer; this.killer = null; diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntitySlime.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntitySlime.java similarity index 77% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntitySlime.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntitySlime.java index cdf2356eb..09be6647a 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/EntitySlime.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntitySlime.java @@ -1,23 +1,8 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; // CraftBukkit start -import net.minecraft.server.v1_6_R3.BiomeBase; -import net.minecraft.server.v1_6_R3.Chunk; -import net.minecraft.server.v1_6_R3.DamageSource; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.EntitySlime; -import net.minecraft.server.v1_6_R3.GenericAttributes; -import net.minecraft.server.v1_6_R3.IMonster; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldType; - -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.SlimeSplitEvent; // CraftBukkit end @@ -39,8 +24,8 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.setSize(i); } - protected void a() { - super.a(); + protected void c() { + super.c(); this.datawatcher.a(16, new Byte((byte) 1)); } @@ -68,16 +53,16 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.setSize(nbttagcompound.getInt("Size") + 1); } - protected String bJ() { + protected String bN() { return "slime"; } - protected String bP() { + protected String bT() { return "mob.slime." + (this.getSize() > 1 ? "big" : "small"); } - public void l_() { - if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) { + public void h() { + if (!this.world.isStatic && this.world.difficulty == EnumDifficulty.PEACEFUL && this.getSize() > 0) { this.dead = true; } @@ -85,7 +70,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.j = this.i; boolean flag = this.onGround; - super.l_(); + super.h(); int i; if (this.onGround && !flag) { @@ -97,11 +82,11 @@ public class EntitySlime extends EntityInsentient implements IMonster { float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1; float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1; - this.world.addParticle(this.bJ(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D); + this.world.addParticle(this.bN(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D); } - if (this.bQ()) { - this.makeSound(this.bP(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); + if (this.bU()) { + this.makeSound(this.bT(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F); } this.h = -0.5F; @@ -109,15 +94,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.h = 1.0F; } - this.bM(); + this.bQ(); if (this.world.isStatic) { i = this.getSize(); this.a(0.6F * (float) i, 0.6F * (float) i); } } - protected void bl() { - this.u(); + protected void bq() { + this.w(); if (Vegetated) return; @@ -144,14 +129,14 @@ public class EntitySlime extends EntityInsentient implements IMonster { } if (this.onGround && this.jumpDelay-- <= 0) { - this.jumpDelay = this.bL(); + this.jumpDelay = this.bP(); if (entityhuman != null) { this.jumpDelay /= 3; } this.bd = true; - if (this.bS()) { - this.makeSound(this.bP(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F); + if (this.bW()) { + this.makeSound(this.bT(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F); } this.be = 1.0F - this.random.nextFloat() * 2.0F; @@ -164,15 +149,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { } } - protected void bM() { + protected void bQ() { this.h *= 0.6F; } - protected int bL() { + protected int bP() { return this.random.nextInt(20) + 10; } - protected EntitySlime bK() { + protected EntitySlime bO() { return new EntitySlime(this.world); } @@ -197,7 +182,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { for (int k = 0; k < j; ++k) { float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F; float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F; - EntitySlime entityslime = this.bK(); + EntitySlime entityslime = this.bO(); entityslime.setSize(i / 2); entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F); @@ -209,33 +194,33 @@ public class EntitySlime extends EntityInsentient implements IMonster { } public void b_(EntityHuman entityhuman) { - if (this.bN()) { + if (this.bR()) { int i = this.getSize(); - if (this.o(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bO())) { + if (this.o(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bS())) { this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F); } } } - protected boolean bN() { + protected boolean bR() { return this.getSize() > 1; } - protected int bO() { + protected int bS() { return this.getSize(); } - protected String aO() { + protected String aT() { return "mob.slime." + (this.getSize() > 1 ? "big" : "small"); } - protected String aP() { + protected String aU() { return "mob.slime." + (this.getSize() > 1 ? "big" : "small"); } - protected int getLootId() { - return this.getSize() == 1 ? Item.SLIME_BALL.id : 0; + protected Item getLoot() { + return this.getSize() == 1 ? Items.SLIME_BALL : Item.d(0); } public boolean canSpawn() { @@ -244,7 +229,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { if (this.world.getWorldData().getType() == WorldType.FLAT && this.random.nextInt(4) != 1) { return false; } else { - if (this.getSize() == 1 || this.world.difficulty > 0) { + if (this.getSize() == 1 || this.world.difficulty != EnumDifficulty.PEACEFUL) { BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < this.world.x() && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) { @@ -260,19 +245,19 @@ public class EntitySlime extends EntityInsentient implements IMonster { } } - protected float ba() { + protected float bf() { return 0.4F * (float) this.getSize(); } - public int bp() { + public int x() { return 0; } - protected boolean bS() { + protected boolean bW() { return this.getSize() > 0; } - protected boolean bQ() { + protected boolean bU() { return this.getSize() > 2; } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityTNTPrimed.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityTNTPrimed.java new file mode 100644 index 000000000..721e7f99b --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/EntityTNTPrimed.java @@ -0,0 +1,100 @@ +package net.minecraft.server.v1_7_R1; + +import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit + +public class EntityTNTPrimed extends Entity { + + public int fuseTicks; + private EntityLiving source; + public float yield = 4; // CraftBukkit + public boolean isIncendiary = false; // CraftBukkit + + public boolean spectating = false; + + public EntityTNTPrimed(World world) { + super(world); + this.l = true; + this.a(0.98F, 0.98F); + this.height = this.length / 2.0F; + } + + public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) { + this(world); + this.setPosition(d0, d1, d2); + float f = (float) (Math.random() * 3.1415927410125732D * 2.0D); + + this.motX = (double) (-((float) Math.sin((double) f)) * 0.02F); + this.motY = 0.20000000298023224D; + this.motZ = (double) (-((float) Math.cos((double) f)) * 0.02F); + this.fuseTicks = 80; + this.lastX = d0; + this.lastY = d1; + this.lastZ = d2; + this.source = entityliving; + } + + protected void c() {} + + protected boolean g_() { + return false; + } + + public boolean R() { + return !this.dead && !spectating; + } + + public void h() { + this.lastX = this.locX; + this.lastY = this.locY; + this.lastZ = this.locZ; + this.motY -= 0.03999999910593033D; + this.move(this.motX, this.motY, this.motZ); + this.motX *= 0.9800000190734863D; + this.motY *= 0.9800000190734863D; + this.motZ *= 0.9800000190734863D; + if (this.onGround) { + this.motX *= 0.699999988079071D; + this.motZ *= 0.699999988079071D; + this.motY *= -0.5D; + } + + if (this.fuseTicks-- <= 0) { + // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event + if (!this.world.isStatic) { + this.explode(); + } + this.die(); + // CraftBukkit end + } else { + this.world.addParticle("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); + } + } + + private void explode() { + // CraftBukkit start + // float f = 4.0F; + + org.bukkit.craftbukkit.v1_7_R1.CraftServer server = this.world.getServer(); + + ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity.getEntity(server, this)); + server.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + // give 'this' instead of (Entity) null so we know what causes the damage + this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), true); + } + // CraftBukkit end + } + + protected void b(NBTTagCompound nbttagcompound) { + nbttagcompound.setByte("Fuse", (byte) this.fuseTicks); + } + + protected void a(NBTTagCompound nbttagcompound) { + this.fuseTicks = nbttagcompound.getByte("Fuse"); + } + + public EntityLiving getSource() { + return this.source; + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/IPacketVerifier.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/IPacketVerifier.java new file mode 100644 index 000000000..5747364a6 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/IPacketVerifier.java @@ -0,0 +1,6 @@ +package net.minecraft.server.v1_7_R1; + +public interface IPacketVerifier +{ + boolean verify(Packet packet); +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayInCloseWindow.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayInCloseWindow.java new file mode 100644 index 000000000..22132846d --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayInCloseWindow.java @@ -0,0 +1,34 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayInCloseWindow + extends Packet +{ + public int a; + + public PacketPlayInCloseWindow() {} + + public PacketPlayInCloseWindow(int id) + { + this.a = id; + } + + public void a(PacketPlayInListener packetplayinlistener) + { + packetplayinlistener.a(this); + } + + public void a(PacketDataSerializer packetdataserializer) + { + this.a = packetdataserializer.readByte(); + } + + public void b(PacketDataSerializer packetdataserializer) + { + packetdataserializer.writeByte(this.a); + } + + public void handle(PacketListener packetlistener) + { + a((PacketPlayInListener)packetlistener); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutAnimation.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutAnimation.java new file mode 100644 index 000000000..035ab6179 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutAnimation.java @@ -0,0 +1,42 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutAnimation extends Packet +{ + public int a; + public int b; + + public PacketPlayOutAnimation() {} + + public PacketPlayOutAnimation(Entity paramEntity, int paramInt) + { + this.a = paramEntity.getId(); + this.b = paramInt; + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.a(); + this.b = paramPacketDataSerializer.readUnsignedByte(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.b(this.a); + paramPacketDataSerializer.writeByte(this.b); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + public String b() + { + return String.format("id=%d, type=%d", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b) }); + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutAttachEntity.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutAttachEntity.java new file mode 100644 index 000000000..8ff892ce0 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutAttachEntity.java @@ -0,0 +1,41 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutAttachEntity extends Packet +{ + public int a; + public int b; + public int c; + + public PacketPlayOutAttachEntity() {} + + public PacketPlayOutAttachEntity(int paramInt, Entity paramEntity1, Entity paramEntity2) + { + this.a = paramInt; + this.b = paramEntity1.getId(); + this.c = (paramEntity2 != null ? paramEntity2.getId() : -1); + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.b = paramPacketDataSerializer.readInt(); + this.c = paramPacketDataSerializer.readInt(); + this.a = paramPacketDataSerializer.readUnsignedByte(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.writeInt(this.b); + paramPacketDataSerializer.writeInt(this.c); + paramPacketDataSerializer.writeByte(this.a); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntity.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntity.java new file mode 100644 index 000000000..1bcd41ea2 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntity.java @@ -0,0 +1,50 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutEntity + extends Packet +{ + public int a; + public byte b; + public byte c; + public byte d; + public byte e; + public byte f; + public boolean g; + + public PacketPlayOutEntity() {} + + public PacketPlayOutEntity(int paramInt) + { + this.a = paramInt; + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.readInt(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.writeInt(this.a); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + public String b() + { + return String.format("id=%d", new Object[] { Integer.valueOf(this.a) }); + } + + public String toString() + { + return "Entity_" + super.toString(); + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityEquipment.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityEquipment.java new file mode 100644 index 000000000..38899efd5 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityEquipment.java @@ -0,0 +1,46 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutEntityEquipment extends Packet +{ + public int a; + public int b; + private ItemStack c; + + public PacketPlayOutEntityEquipment() {} + + public PacketPlayOutEntityEquipment(int paramInt1, int paramInt2, ItemStack paramItemStack) + { + this.a = paramInt1; + this.b = paramInt2; + this.c = (paramItemStack == null ? null : paramItemStack.cloneItemStack()); + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.readInt(); + this.b = paramPacketDataSerializer.readShort(); + this.c = paramPacketDataSerializer.c(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.writeInt(this.a); + paramPacketDataSerializer.writeShort(this.b); + paramPacketDataSerializer.a(this.c); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + public String b() + { + return String.format("entity=%d, slot=%d, item=%s", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), this.c }); + } + +@Override +public void handle(PacketListener paramPacketListener) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityMetadata.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityMetadata.java new file mode 100644 index 000000000..72f39f13e --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityMetadata.java @@ -0,0 +1,43 @@ +package net.minecraft.server.v1_7_R1; + +import java.util.List; + +public class PacketPlayOutEntityMetadata extends Packet +{ + public int a; + public List b; + + public PacketPlayOutEntityMetadata() {} + + public PacketPlayOutEntityMetadata(int paramInt, DataWatcher paramDataWatcher, boolean paramBoolean) + { + this.a = paramInt; + if (paramBoolean) { + this.b = paramDataWatcher.c(); + } else { + this.b = paramDataWatcher.b(); + } + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.readInt(); + this.b = DataWatcher.b(paramPacketDataSerializer); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.writeInt(this.a); + DataWatcher.a(this.b, paramPacketDataSerializer); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityTeleport.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityTeleport.java new file mode 100644 index 000000000..68be29b8f --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityTeleport.java @@ -0,0 +1,66 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutEntityTeleport extends Packet +{ + public int a; + public int b; + public int c; + public int d; + public byte e; + public byte f; + + public PacketPlayOutEntityTeleport() + { + } + + public PacketPlayOutEntityTeleport(Entity paramEntity) + { + this.a = paramEntity.getId(); + this.b = MathHelper.floor(paramEntity.locX * 32.0D); + this.c = MathHelper.floor(paramEntity.locY * 32.0D); + this.d = MathHelper.floor(paramEntity.locZ * 32.0D); + this.e = ((byte) (int) (paramEntity.yaw * 256.0F / 360.0F)); + this.f = ((byte) (int) (paramEntity.pitch * 256.0F / 360.0F)); + } + + public PacketPlayOutEntityTeleport(int paramInt1, int paramInt2, int paramInt3, int paramInt4, byte paramByte1, + byte paramByte2) + { + this.a = paramInt1; + this.b = paramInt2; + this.c = paramInt3; + this.d = paramInt4; + this.e = paramByte1; + this.f = paramByte2; + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.readInt(); + this.b = paramPacketDataSerializer.readInt(); + this.c = paramPacketDataSerializer.readInt(); + this.d = paramPacketDataSerializer.readInt(); + this.e = paramPacketDataSerializer.readByte(); + this.f = paramPacketDataSerializer.readByte(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.writeInt(this.a); + paramPacketDataSerializer.writeInt(this.b); + paramPacketDataSerializer.writeInt(this.c); + paramPacketDataSerializer.writeInt(this.d); + paramPacketDataSerializer.writeByte(this.e); + paramPacketDataSerializer.writeByte(this.f); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + @Override + public void handle(PacketListener arg0) + { + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityVelocity.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityVelocity.java new file mode 100644 index 000000000..3ee5112ec --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutEntityVelocity.java @@ -0,0 +1,75 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutEntityVelocity + extends Packet +{ + public int a; + public int b; + public int c; + public int d; + + public PacketPlayOutEntityVelocity() {} + + public PacketPlayOutEntityVelocity(Entity paramEntity) + { + this(paramEntity.getId(), paramEntity.motX, paramEntity.motY, paramEntity.motZ); + } + + public PacketPlayOutEntityVelocity(int paramInt, double paramDouble1, double paramDouble2, double paramDouble3) + { + this.a = paramInt; + double d1 = 3.9D; + if (paramDouble1 < -d1) { + paramDouble1 = -d1; + } + if (paramDouble2 < -d1) { + paramDouble2 = -d1; + } + if (paramDouble3 < -d1) { + paramDouble3 = -d1; + } + if (paramDouble1 > d1) { + paramDouble1 = d1; + } + if (paramDouble2 > d1) { + paramDouble2 = d1; + } + if (paramDouble3 > d1) { + paramDouble3 = d1; + } + this.b = ((int)(paramDouble1 * 8000.0D)); + this.c = ((int)(paramDouble2 * 8000.0D)); + this.d = ((int)(paramDouble3 * 8000.0D)); + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.readInt(); + this.b = paramPacketDataSerializer.readShort(); + this.c = paramPacketDataSerializer.readShort(); + this.d = paramPacketDataSerializer.readShort(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.writeInt(this.a); + paramPacketDataSerializer.writeShort(this.b); + paramPacketDataSerializer.writeShort(this.c); + paramPacketDataSerializer.writeShort(this.d); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + public String b() + { + return String.format("id=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Float.valueOf(this.b / 8000.0F), Float.valueOf(this.c / 8000.0F), Float.valueOf(this.d / 8000.0F) }); + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutNamedEntitySpawn.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutNamedEntitySpawn.java new file mode 100644 index 000000000..a5b58c69b --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutNamedEntitySpawn.java @@ -0,0 +1,80 @@ +package net.minecraft.server.v1_7_R1; + +import java.io.IOException; +import java.util.List; +import net.minecraft.util.com.mojang.authlib.GameProfile; + +public class PacketPlayOutNamedEntitySpawn extends Packet +{ + public int a; + public GameProfile b; + public int c; + public int d; + public int e; + public byte f; + public byte g; + public int h; + public DataWatcher i; + public List j; + + public PacketPlayOutNamedEntitySpawn() {} + + public PacketPlayOutNamedEntitySpawn(EntityHuman entityhuman) + { + this.a = entityhuman.getId(); + this.b = entityhuman.getProfile(); + this.c = MathHelper.floor(entityhuman.locX * 32.0D); + this.d = MathHelper.floor(entityhuman.locY * 32.0D); + this.e = MathHelper.floor(entityhuman.locZ * 32.0D); + this.f = ((byte)(int)(entityhuman.yaw * 256.0F / 360.0F)); + this.g = ((byte)(int)(entityhuman.pitch * 256.0F / 360.0F)); + ItemStack itemstack = entityhuman.inventory.getItemInHand(); + + this.h = (itemstack == null ? 0 : Item.b(itemstack.getItem())); + this.i = entityhuman.getDataWatcher(); + } + + public void a(PacketDataSerializer packetdataserializer) + throws IOException + { + this.a = packetdataserializer.a(); + this.b = new GameProfile(packetdataserializer.c(36), packetdataserializer.c(16)); + this.c = packetdataserializer.readInt(); + this.d = packetdataserializer.readInt(); + this.e = packetdataserializer.readInt(); + this.f = packetdataserializer.readByte(); + this.g = packetdataserializer.readByte(); + this.h = packetdataserializer.readShort(); + this.j = DataWatcher.b(packetdataserializer); + } + + public void b(PacketDataSerializer packetdataserializer) + throws IOException + { + packetdataserializer.b(this.a); + packetdataserializer.a(this.b.getId()); + packetdataserializer.a(this.b.getName().length() > 16 ? this.b.getName().substring(0, 16) : this.b.getName()); + packetdataserializer.writeInt(this.c); + packetdataserializer.writeInt(this.d); + packetdataserializer.writeInt(this.e); + packetdataserializer.writeByte(this.f); + packetdataserializer.writeByte(this.g); + packetdataserializer.writeShort(this.h); + this.i.a(packetdataserializer); + } + + public void a(PacketPlayOutListener packetplayoutlistener) + { + packetplayoutlistener.a(this); + } + + public String b() + { + return String.format("id=%d, gameProfile='%s', x=%.2f, y=%.2f, z=%.2f, carried=%d", new Object[] { Integer.valueOf(this.a), this.b, Float.valueOf(this.c / 32.0F), Float.valueOf(this.d / 32.0F), Float.valueOf(this.e / 32.0F), Integer.valueOf(this.h) }); + } + + public void handle(PacketListener packetlistener) + { + a((PacketPlayOutListener)packetlistener); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutRelEntityMove.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutRelEntityMove.java new file mode 100644 index 000000000..42d53a950 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutRelEntityMove.java @@ -0,0 +1,36 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutRelEntityMove + extends PacketPlayOutEntity +{ + public PacketPlayOutRelEntityMove() {} + + public PacketPlayOutRelEntityMove(int paramInt, byte paramByte1, byte paramByte2, byte paramByte3) + { + super(paramInt); + this.b = paramByte1; + this.c = paramByte2; + this.d = paramByte3; + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + super.a(paramPacketDataSerializer); + this.b = paramPacketDataSerializer.readByte(); + this.c = paramPacketDataSerializer.readByte(); + this.d = paramPacketDataSerializer.readByte(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + super.b(paramPacketDataSerializer); + paramPacketDataSerializer.writeByte(this.b); + paramPacketDataSerializer.writeByte(this.c); + paramPacketDataSerializer.writeByte(this.d); + } + + public String b() + { + return super.b() + String.format(", xa=%d, ya=%d, za=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d) }); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutRelEntityMoveLook.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutRelEntityMoveLook.java new file mode 100644 index 000000000..643c6b867 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutRelEntityMoveLook.java @@ -0,0 +1,46 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutRelEntityMoveLook + extends PacketPlayOutEntity +{ + public PacketPlayOutRelEntityMoveLook() + { + this.g = true; + } + + public PacketPlayOutRelEntityMoveLook(int paramInt, byte paramByte1, byte paramByte2, byte paramByte3, byte paramByte4, byte paramByte5) + { + super(paramInt); + this.b = paramByte1; + this.c = paramByte2; + this.d = paramByte3; + this.e = paramByte4; + this.f = paramByte5; + this.g = true; + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + super.a(paramPacketDataSerializer); + this.b = paramPacketDataSerializer.readByte(); + this.c = paramPacketDataSerializer.readByte(); + this.d = paramPacketDataSerializer.readByte(); + this.e = paramPacketDataSerializer.readByte(); + this.f = paramPacketDataSerializer.readByte(); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + super.b(paramPacketDataSerializer); + paramPacketDataSerializer.writeByte(this.b); + paramPacketDataSerializer.writeByte(this.c); + paramPacketDataSerializer.writeByte(this.d); + paramPacketDataSerializer.writeByte(this.e); + paramPacketDataSerializer.writeByte(this.f); + } + + public String b() + { + return super.b() + String.format(", xa=%d, ya=%d, za=%d, yRot=%d, xRot=%d", new Object[] { Byte.valueOf(this.b), Byte.valueOf(this.c), Byte.valueOf(this.d), Byte.valueOf(this.e), Byte.valueOf(this.f) }); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutSpawnEntity.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutSpawnEntity.java new file mode 100644 index 000000000..24c0ab51f --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutSpawnEntity.java @@ -0,0 +1,144 @@ +package net.minecraft.server.v1_7_R1; + +public class PacketPlayOutSpawnEntity extends Packet +{ + public int a; + public int b; + public int c; + public int d; + public int e; + public int f; + public int g; + public int h; + public int i; + public int j; + public int k; + + public PacketPlayOutSpawnEntity() {} + + public PacketPlayOutSpawnEntity(Entity paramEntity, int paramInt) + { + this(paramEntity, paramInt, 0); + } + + public PacketPlayOutSpawnEntity(Entity paramEntity, int paramInt1, int paramInt2) + { + this.a = paramEntity.getId(); + this.b = MathHelper.floor(paramEntity.locX * 32.0D); + this.c = MathHelper.floor(paramEntity.locY * 32.0D); + this.d = MathHelper.floor(paramEntity.locZ * 32.0D); + this.h = MathHelper.d(paramEntity.pitch * 256.0F / 360.0F); + this.i = MathHelper.d(paramEntity.yaw * 256.0F / 360.0F); + this.j = paramInt1; + this.k = paramInt2; + if (paramInt2 > 0) + { + double d1 = paramEntity.motX; + double d2 = paramEntity.motY; + double d3 = paramEntity.motZ; + double d4 = 3.9D; + if (d1 < -d4) { + d1 = -d4; + } + if (d2 < -d4) { + d2 = -d4; + } + if (d3 < -d4) { + d3 = -d4; + } + if (d1 > d4) { + d1 = d4; + } + if (d2 > d4) { + d2 = d4; + } + if (d3 > d4) { + d3 = d4; + } + this.e = ((int)(d1 * 8000.0D)); + this.f = ((int)(d2 * 8000.0D)); + this.g = ((int)(d3 * 8000.0D)); + } + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.a(); + this.j = paramPacketDataSerializer.readByte(); + this.b = paramPacketDataSerializer.readInt(); + this.c = paramPacketDataSerializer.readInt(); + this.d = paramPacketDataSerializer.readInt(); + this.h = paramPacketDataSerializer.readByte(); + this.i = paramPacketDataSerializer.readByte(); + this.k = paramPacketDataSerializer.readInt(); + if (this.k > 0) + { + this.e = paramPacketDataSerializer.readShort(); + this.f = paramPacketDataSerializer.readShort(); + this.g = paramPacketDataSerializer.readShort(); + } + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.b(this.a); + paramPacketDataSerializer.writeByte(this.j); + paramPacketDataSerializer.writeInt(this.b); + paramPacketDataSerializer.writeInt(this.c); + paramPacketDataSerializer.writeInt(this.d); + paramPacketDataSerializer.writeByte(this.h); + paramPacketDataSerializer.writeByte(this.i); + paramPacketDataSerializer.writeInt(this.k); + if (this.k > 0) + { + paramPacketDataSerializer.writeShort(this.e); + paramPacketDataSerializer.writeShort(this.f); + paramPacketDataSerializer.writeShort(this.g); + } + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + public String b() + { + return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.j), Float.valueOf(this.b / 32.0F), Float.valueOf(this.c / 32.0F), Float.valueOf(this.d / 32.0F) }); + } + + public void a(int paramInt) + { + this.b = paramInt; + } + + public void b(int paramInt) + { + this.c = paramInt; + } + + public void c(int paramInt) + { + this.d = paramInt; + } + + public void d(int paramInt) + { + this.e = paramInt; + } + + public void e(int paramInt) + { + this.f = paramInt; + } + + public void f(int paramInt) + { + this.g = paramInt; + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutSpawnEntityLiving.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutSpawnEntityLiving.java new file mode 100644 index 000000000..6160c23a6 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketPlayOutSpawnEntityLiving.java @@ -0,0 +1,111 @@ +package net.minecraft.server.v1_7_R1; + +import java.util.List; + +public class PacketPlayOutSpawnEntityLiving extends Packet +{ + public int a; + public int b; + public int c; + public int d; + public int e; + public int f; + public int g; + public int h; + public byte i; + public byte j; + public byte k; + public DataWatcher l; + public List m; + + public PacketPlayOutSpawnEntityLiving() {} + + public PacketPlayOutSpawnEntityLiving(EntityLiving paramEntityLiving) + { + this.a = paramEntityLiving.getId(); + + this.b = ((byte)EntityTypes.a(paramEntityLiving)); + this.c = paramEntityLiving.at.a(paramEntityLiving.locX); + this.d = MathHelper.floor(paramEntityLiving.locY * 32.0D); + this.e = paramEntityLiving.at.a(paramEntityLiving.locZ); + this.i = ((byte)(int)(paramEntityLiving.yaw * 256.0F / 360.0F)); + this.j = ((byte)(int)(paramEntityLiving.pitch * 256.0F / 360.0F)); + this.k = ((byte)(int)(paramEntityLiving.aP * 256.0F / 360.0F)); + + + double d1 = 3.9D; + double d2 = paramEntityLiving.motX; + double d3 = paramEntityLiving.motY; + double d4 = paramEntityLiving.motZ; + if (d2 < -d1) { + d2 = -d1; + } + if (d3 < -d1) { + d3 = -d1; + } + if (d4 < -d1) { + d4 = -d1; + } + if (d2 > d1) { + d2 = d1; + } + if (d3 > d1) { + d3 = d1; + } + if (d4 > d1) { + d4 = d1; + } + this.f = ((int)(d2 * 8000.0D)); + this.g = ((int)(d3 * 8000.0D)); + this.h = ((int)(d4 * 8000.0D)); + + this.l = paramEntityLiving.getDataWatcher(); + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + this.a = paramPacketDataSerializer.a(); + this.b = (paramPacketDataSerializer.readByte() & 0xFF); + this.c = paramPacketDataSerializer.readInt(); + this.d = paramPacketDataSerializer.readInt(); + this.e = paramPacketDataSerializer.readInt(); + this.i = paramPacketDataSerializer.readByte(); + this.j = paramPacketDataSerializer.readByte(); + this.k = paramPacketDataSerializer.readByte(); + this.f = paramPacketDataSerializer.readShort(); + this.g = paramPacketDataSerializer.readShort(); + this.h = paramPacketDataSerializer.readShort(); + this.m = DataWatcher.b(paramPacketDataSerializer); + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.b(this.a); + paramPacketDataSerializer.writeByte(this.b & 0xFF); + paramPacketDataSerializer.writeInt(this.c); + paramPacketDataSerializer.writeInt(this.d); + paramPacketDataSerializer.writeInt(this.e); + paramPacketDataSerializer.writeByte(this.i); + paramPacketDataSerializer.writeByte(this.j); + paramPacketDataSerializer.writeByte(this.k); + paramPacketDataSerializer.writeShort(this.f); + paramPacketDataSerializer.writeShort(this.g); + paramPacketDataSerializer.writeShort(this.h); + this.l.a(paramPacketDataSerializer); + } + + public void a(PacketPlayOutListener paramPacketPlayOutListener) + { + paramPacketPlayOutListener.a(this); + } + + public String b() + { + return String.format("id=%d, type=%d, x=%.2f, y=%.2f, z=%.2f, xd=%.2f, yd=%.2f, zd=%.2f", new Object[] { Integer.valueOf(this.a), Integer.valueOf(this.b), Float.valueOf(this.c / 32.0F), Float.valueOf(this.d / 32.0F), Float.valueOf(this.e / 32.0F), Float.valueOf(this.f / 8000.0F), Float.valueOf(this.g / 8000.0F), Float.valueOf(this.h / 8000.0F) }); + } + +@Override +public void handle(PacketListener arg0) +{ +} +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketProcessor.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketProcessor.java new file mode 100644 index 000000000..56cc9ddb1 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PacketProcessor.java @@ -0,0 +1,44 @@ +package net.minecraft.server.v1_7_R1; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; + +public class PacketProcessor +{ + private List _packetVerifiers; + + public PacketProcessor() + { + _packetVerifiers = new ArrayList(); + } + + public void addPacketVerifier(IPacketVerifier verifier) + { + _packetVerifiers.add(verifier); + } + + public void processPacket(Packet packet, NetworkManager networkManager) + { + boolean addDefaultPacket = true; + + for (IPacketVerifier verifier : _packetVerifiers) + { + if (!verifier.verify(packet)) + { + addDefaultPacket = false; + } + } + + if (addDefaultPacket) + { + networkManager.handle(packet, new GenericFutureListener[0]); + } + } + + public void clearVerifiers() + { + _packetVerifiers.clear(); + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerChunk.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerChunk.java similarity index 66% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerChunk.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerChunk.java index 026bc9425..cbb949730 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerChunk.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerChunk.java @@ -1,18 +1,12 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.ArrayList; import java.util.List; -import net.minecraft.server.v1_6_R3.Chunk; -import net.minecraft.server.v1_6_R3.ChunkCoordIntPair; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet51MapChunk; -import net.minecraft.server.v1_6_R3.Packet52MultiBlockChange; -import net.minecraft.server.v1_6_R3.Packet53BlockChange; -import net.minecraft.server.v1_6_R3.PlayerChunk; -import net.minecraft.server.v1_6_R3.PlayerChunkMap; -import net.minecraft.server.v1_6_R3.TileEntity; +//CraftBukkit start +import org.bukkit.craftbukkit.v1_7_R1.chunkio.ChunkIOExecutor; +import java.util.HashMap; +//CraftBukkit end class PlayerChunk { @@ -22,22 +16,23 @@ class PlayerChunk { private int dirtyCount; private int f; private long g; - private boolean loaded = false; // CraftBukkit - final PlayerChunkMap playerChunkMap; + // CraftBukkit start + private final HashMap players = new HashMap(); + private boolean loaded = false; + private Runnable loadedRunnable = new Runnable() { + public void run() { + PlayerChunk.this.loaded = true; + } + }; + // CraftBukkit end public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) { this.playerChunkMap = playerchunkmap; this.b = new ArrayList(); this.dirtyBlocks = new short[64]; this.location = new ChunkCoordIntPair(i, j); - // CraftBukkit start - playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, new Runnable() { - public void run() { - PlayerChunk.this.loaded = true; - } - }); - // CraftBukkit end + playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, this.loadedRunnable); // CraftBukkit } public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument @@ -49,31 +44,52 @@ class PlayerChunk { } this.b.add(entityplayer); - // CraftBukkit start + Runnable playerRunnable; if (this.loaded) { + playerRunnable = null; entityplayer.chunkCoordIntPairQueue.add(this.location); } else { - // Abuse getChunkAt to add another callback - this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, new Runnable() { + playerRunnable = new Runnable() { public void run() { entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location); } - }); + }; + this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, playerRunnable); } + + this.players.put(entityplayer, playerRunnable); // CraftBukkit end } } public void b(EntityPlayer entityplayer) { if (this.b.contains(entityplayer)) { - Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z); - - if (chunk.x == location.x && chunk.z == location.z) - { - entityplayer.playerConnection.sendPacket(new Packet51MapChunk(chunk, true, 0)); - } - + // CraftBukkit start - If we haven't loaded yet don't load the chunk just so we can clean it up + if (!this.loaded) { + ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.a(), this.location.x, this.location.z, this.players.get(entityplayer)); + this.b.remove(entityplayer); + this.players.remove(entityplayer); + + if (this.b.isEmpty()) { + ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.a(), this.location.x, this.location.z, this.loadedRunnable); + long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32; + PlayerChunkMap.b(this.playerChunkMap).remove(i); + PlayerChunkMap.c(this.playerChunkMap).remove(this); + } + + return; + } + // CraftBukkit end + + Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z); + + if (chunk.k() && chunk.locX == location.x && chunk.locZ == location.z) + { + entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0)); + } + + this.players.remove(entityplayer); // CraftBukkit this.b.remove(entityplayer); entityplayer.chunkCoordIntPairQueue.remove(this.location); if (this.b.isEmpty()) { @@ -96,7 +112,7 @@ class PlayerChunk { } private void a(Chunk chunk) { - chunk.q += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g; + chunk.s += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g; this.g = PlayerChunkMap.a(this.playerChunkMap).getTime(); } @@ -139,8 +155,8 @@ class PlayerChunk { i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15); j = this.dirtyBlocks[0] & 255; k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15); - this.sendAll(new Packet53BlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap))); - if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(i, j, k)) { + this.sendAll(new PacketPlayOutBlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap))); + if (PlayerChunkMap.a(this.playerChunkMap).getType(i, j, k).isTileEntity()) { this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(i, j, k)); } } else { @@ -149,7 +165,7 @@ class PlayerChunk { if (this.dirtyCount == 64) { i = this.location.x * 16; j = this.location.z * 16; - this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); + this.sendAll(new PacketPlayOutMapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged for (k = 0; k < 16; ++k) { if ((this.f & 1 << k) != 0) { @@ -162,13 +178,13 @@ class PlayerChunk { } } } else { - this.sendAll(new Packet52MultiBlockChange(this.location.x, this.location.z, this.dirtyBlocks, this.dirtyCount, PlayerChunkMap.a(this.playerChunkMap))); + this.sendAll(new PacketPlayOutMultiBlockChange(this.dirtyCount, this.dirtyBlocks, PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z))); for (i = 0; i < this.dirtyCount; ++i) { j = this.location.x * 16 + (this.dirtyBlocks[i] >> 12 & 15); k = this.dirtyBlocks[i] & 255; l = this.location.z * 16 + (this.dirtyBlocks[i] >> 8 & 15); - if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(j, k, l)) { + if (PlayerChunkMap.a(this.playerChunkMap).getType(j, k, l).isTileEntity()) { this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(j, k, l)); } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerConnection.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerConnection.java new file mode 100644 index 000000000..98b39deab --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerConnection.java @@ -0,0 +1,2528 @@ +package net.minecraft.server.v1_7_R1; + +import java.io.ByteArrayInputStream; +import java.io.DataInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Random; +import java.util.concurrent.Callable; + +import net.minecraft.util.com.google.common.base.Charsets; +import net.minecraft.util.com.google.common.collect.Lists; +import net.minecraft.util.io.netty.buffer.Unpooled; +import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; +import net.minecraft.util.org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +// CraftBukkit start +import java.io.UnsupportedEncodingException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; +import java.util.HashSet; + +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventoryView; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage; +import org.bukkit.craftbukkit.v1_7_R1.util.LazyPlayerSet; +import org.bukkit.craftbukkit.v1_7_R1.util.Waitable; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.event.Event; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.SignChangeEvent; +import org.bukkit.event.inventory.ClickType; +import org.bukkit.event.inventory.CraftItemEvent; +import org.bukkit.event.inventory.InventoryAction; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryCreativeEvent; +import org.bukkit.event.inventory.InventoryType.SlotType; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerAnimationEvent; +import org.bukkit.event.player.PlayerChatEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; +import org.bukkit.event.player.PlayerKickEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerTeleportEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.event.player.PlayerToggleSneakEvent; +import org.bukkit.event.player.PlayerToggleSprintEvent; +import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.InventoryView; +import org.bukkit.util.NumberConversions; + +// CraftBukkit end + +public class PlayerConnection implements PacketPlayInListener +{ + + private static final Logger c = LogManager.getLogger(); + public NetworkManager networkManager; + private final MinecraftServer minecraftServer; + public EntityPlayer player; + private int e; + private int f; + private boolean g; + private int h; + private long i; + private static Random j = new Random(); + private long k; + private volatile int chatThrottle; + private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater( + PlayerConnection.class, "chatThrottle"); // CraftBukkit - + // multithreaded field + private int x; + private IntHashMap n = new IntHashMap(); + private double y; + private double z; + private double q; + public boolean checkMovement = true; // CraftBukkit - private -> public + private boolean processedDisconnect; // CraftBukkit - added + + public PacketProcessor PacketVerifier; + + public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) + { + this.minecraftServer = minecraftserver; + this.networkManager = networkmanager; + networkmanager.a((PacketListener) this); + this.player = entityplayer; + entityplayer.playerConnection = this; + + PacketVerifier = new PacketProcessor(); + + // CraftBukkit start + this.server = minecraftserver.server; + } + + private final org.bukkit.craftbukkit.v1_7_R1.CraftServer server; + private int lastTick = MinecraftServer.currentTick; + private int lastDropTick = MinecraftServer.currentTick; + private int dropCount = 0; + private static final int SURVIVAL_PLACE_DISTANCE_SQUARED = 6 * 6; + private static final int CREATIVE_PLACE_DISTANCE_SQUARED = 7 * 7; + + // Get position of last block hit for BlockDamageLevel.STOPPED + private double lastPosX = Double.MAX_VALUE; + private double lastPosY = Double.MAX_VALUE; + private double lastPosZ = Double.MAX_VALUE; + private float lastPitch = Float.MAX_VALUE; + private float lastYaw = Float.MAX_VALUE; + private boolean justTeleported = false; + + // For the PacketPlayOutBlockPlace hack :( + Long lastPacket; + + // Store the last block right clicked and what type it was + private Item lastMaterial; + + public CraftPlayer getPlayer() + { + return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity(); + } + + private final static HashSet invalidItems = new HashSet(java.util.Arrays.asList(8, 9, 10, 11, 26, + 34, 36, 43, 51, 52, 55, 59, 60, 62, 63, 64, 68, 71, 74, 75, 83, 90, 92, 93, 94, 104, 105, 115, 117, 118, + 119, 125, 127, 132, 137, 140, 141, 142, 144)); // TODO: Check after + // every update. + + // CraftBukkit end + + public void a() + { + this.g = false; + ++this.e; + this.minecraftServer.methodProfiler.a("keepAlive"); + if ((long) this.e - this.k > 40L) + { + this.k = (long) this.e; + this.i = this.d(); + this.h = (int) this.i; + this.sendPacket(new PacketPlayOutKeepAlive(this.h)); + } + + // CraftBukkit start + for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1);) + ; + /* + * Use thread-safe field access instead if (this.chatThrottle > 0) { + * --this.chatThrottle; } + */ + // CraftBukkit end + + if (this.x > 0) + { + --this.x; + } + + this.minecraftServer.methodProfiler.c("playerTick"); + this.minecraftServer.methodProfiler.b(); + } + + public NetworkManager b() + { + return this.networkManager; + } + + public void disconnect(String s) + { + // CraftBukkit start + String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game."; + + PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage); + + if (this.server.getServer().isRunning()) + { + this.server.getPluginManager().callEvent(event); + } + + if (event.isCancelled()) + { + // Do not kick the player + return; + } + // Send the possibly modified leave message + s = event.getReason(); + // CraftBukkit end + ChatComponentText chatcomponenttext = new ChatComponentText(s); + + this.networkManager.handle(new PacketPlayOutKickDisconnect(chatcomponenttext), + new GenericFutureListener[] { new PlayerConnectionFuture(this, chatcomponenttext) }); + this.a(chatcomponenttext); // CraftBukkit - Process quit immediately + this.networkManager.g(); + } + + public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) + { + this.player.a(packetplayinsteervehicle.c(), packetplayinsteervehicle.d(), packetplayinsteervehicle.e(), + packetplayinsteervehicle.f()); + } + + public void a(PacketPlayInFlying packetplayinflying) + { + // CraftBukkit start - Check for NaN + if (Double.isNaN(packetplayinflying.x) || Double.isNaN(packetplayinflying.y) + || Double.isNaN(packetplayinflying.z) || Double.isNaN(packetplayinflying.stance)) + { + c.warn(player.getName() + " was caught trying to crash the server with an invalid position."); + getPlayer().kickPlayer("Nope!"); + return; + } + // CraftBukkit end + + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + this.g = true; + if (!this.player.viewingCredits) + { + double d0; + + if (!this.checkMovement) + { + d0 = packetplayinflying.d() - this.z; + if (packetplayinflying.c() == this.y && d0 * d0 < 0.01D && packetplayinflying.e() == this.q) + { + this.checkMovement = true; + } + } + + // CraftBukkit start + Player player = this.getPlayer(); + Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get + // the + // Players + // previous + // Event + // location. + Location to = player.getLocation().clone(); // Start off the To + // location as the + // Players current + // location. + + // If the packet contains movement information then we update the To + // location with the correct XYZ. + if (packetplayinflying.hasPos + && !(packetplayinflying.hasPos && packetplayinflying.y == -999.0D && packetplayinflying.stance == -999.0D)) + { + to.setX(packetplayinflying.x); + to.setY(packetplayinflying.y); + to.setZ(packetplayinflying.z); + } + + // If the packet contains look information then we update the To + // location with the correct Yaw & Pitch. + if (packetplayinflying.hasLook) + { + to.setYaw(packetplayinflying.yaw); + to.setPitch(packetplayinflying.pitch); + } + + // Prevent 40 event-calls for less than a single pixel of movement + // >.> + double delta = Math.pow(this.lastPosX - to.getX(), 2) + Math.pow(this.lastPosY - to.getY(), 2) + + Math.pow(this.lastPosZ - to.getZ(), 2); + float deltaAngle = Math.abs(this.lastYaw - to.getYaw()) + Math.abs(this.lastPitch - to.getPitch()); + + if ((delta > 1f / 256 || deltaAngle > 10f) && (this.checkMovement && !this.player.dead)) + { + this.lastPosX = to.getX(); + this.lastPosY = to.getY(); + this.lastPosZ = to.getZ(); + this.lastYaw = to.getYaw(); + this.lastPitch = to.getPitch(); + + // Skip the first time we do this + if (from.getX() != Double.MAX_VALUE) + { + PlayerMoveEvent event = new PlayerMoveEvent(player, from, to); + this.server.getPluginManager().callEvent(event); + + // If the event is cancelled we move the player back to + // their old location. + if (event.isCancelled()) + { + this.player.playerConnection.sendPacket(new PacketPlayOutPosition(from.getX(), + from.getY() + 1.6200000047683716D, from.getZ(), from.getYaw(), from.getPitch(), false)); + return; + } + + /* + * If a Plugin has changed the To destination then we + * teleport the Player there to avoid any 'Moved wrongly' or + * 'Moved too quickly' errors. We only do this if the Event + * was not cancelled. + */ + if (!to.equals(event.getTo()) && !event.isCancelled()) + { + this.player.getBukkitEntity() + .teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + return; + } + + /* + * Check to see if the Players Location has some how changed + * during the call of the event. This can happen due to a + * plugin teleporting the player instead of using .setTo() + */ + if (!from.equals(this.getPlayer().getLocation()) && this.justTeleported) + { + this.justTeleported = false; + return; + } + } + } + + if (this.checkMovement && !this.player.dead) + { + // CraftBukkit end + double d1; + double d2; + double d3; + + if (this.player.vehicle != null) + { + float f = this.player.yaw; + float f1 = this.player.pitch; + + this.player.vehicle.ac(); + d1 = this.player.locX; + d2 = this.player.locY; + d3 = this.player.locZ; + if (packetplayinflying.k()) + { + f = packetplayinflying.g(); + f1 = packetplayinflying.h(); + } + + this.player.onGround = packetplayinflying.i(); + this.player.i(); + this.player.W = 0.0F; + this.player.setLocation(d1, d2, d3, f, f1); + if (this.player.vehicle != null) + { + this.player.vehicle.ac(); + } + + this.minecraftServer.getPlayerList().d(this.player); + if (this.checkMovement) + { + this.y = this.player.locX; + this.z = this.player.locY; + this.q = this.player.locZ; + } + + worldserver.playerJoinedWorld(this.player); + return; + } + + if (this.player.isSleeping()) + { + this.player.i(); + this.player.setLocation(this.y, this.z, this.q, this.player.yaw, this.player.pitch); + worldserver.playerJoinedWorld(this.player); + return; + } + + d0 = this.player.locY; + this.y = this.player.locX; + this.z = this.player.locY; + this.q = this.player.locZ; + d1 = this.player.locX; + d2 = this.player.locY; + d3 = this.player.locZ; + float f2 = this.player.yaw; + float f3 = this.player.pitch; + + if (packetplayinflying.j() && packetplayinflying.d() == -999.0D && packetplayinflying.f() == -999.0D) + { + packetplayinflying.a(false); + } + + double d4; + + if (packetplayinflying.j()) + { + d1 = packetplayinflying.c(); + d2 = packetplayinflying.d(); + d3 = packetplayinflying.e(); + d4 = packetplayinflying.f() - packetplayinflying.d(); + if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) + { + this.disconnect("Illegal stance"); + c.warn(this.player.getName() + " had an illegal stance: " + d4); + return; + } + + if (Math.abs(packetplayinflying.c()) > 3.2E7D || Math.abs(packetplayinflying.e()) > 3.2E7D) + { + this.disconnect("Illegal position"); + return; + } + } + + if (packetplayinflying.k()) + { + f2 = packetplayinflying.g(); + f3 = packetplayinflying.h(); + } + + this.player.i(); + this.player.W = 0.0F; + this.player.setLocation(this.y, this.z, this.q, f2, f3); + if (!this.checkMovement) + { + return; + } + + d4 = d1 - this.player.locX; + double d5 = d2 - this.player.locY; + double d6 = d3 - this.player.locZ; + // CraftBukkit start - min to max + double d7 = Math.max(Math.abs(d4), Math.abs(this.player.motX)); + double d8 = Math.max(Math.abs(d5), Math.abs(this.player.motY)); + double d9 = Math.max(Math.abs(d6), Math.abs(this.player.motZ)); + // CraftBukkit end + double d10 = d7 * d7 + d8 * d8 + d9 * d9; + + if (d10 > 100.0D && this.checkMovement + && (!this.minecraftServer.L() || !this.minecraftServer.K().equals(this.player.getName()))) + { // CraftBukkit - Added this.checkMovement condition to solve + // this check being triggered by teleports + c.warn(this.player.getName() + " moved too quickly! " + d4 + "," + d5 + "," + d6 + " (" + d7 + ", " + + d8 + ", " + d9 + ")"); + this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch); + return; + } + + float f4 = 0.0625F; + boolean flag = worldserver.getCubes(this.player, + this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty(); + + if (this.player.onGround && !packetplayinflying.i() && d5 > 0.0D) + { + this.player.bj(); + } + + this.player.move(d4, d5, d6); + this.player.onGround = packetplayinflying.i(); + this.player.checkMovement(d4, d5, d6); + double d11 = d5; + + d4 = d1 - this.player.locX; + d5 = d2 - this.player.locY; + if (d5 > -0.5D || d5 < 0.5D) + { + d5 = 0.0D; + } + + d6 = d3 - this.player.locZ; + d10 = d4 * d4 + d5 * d5 + d6 * d6; + boolean flag1 = false; + + if (d10 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) + { + flag1 = true; + c.warn(this.player.getName() + " moved wrongly!"); + } + + this.player.setLocation(d1, d2, d3, f2, f3); + boolean flag2 = worldserver.getCubes(this.player, + this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty(); + + if (flag && (flag1 || !flag2) && !this.player.isSleeping()) + { + this.a(this.y, this.z, this.q, f2, f3); + return; + } + + AxisAlignedBB axisalignedbb = this.player.boundingBox.clone() + .grow((double) f4, (double) f4, (double) f4).a(0.0D, -0.55D, 0.0D); + + if (!this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly + && !worldserver.c(axisalignedbb)) + { // CraftBukkit - check abilities instead of creative mode + if (d11 >= -0.03125D) + { + ++this.f; + if (this.f > 80) + { + c.warn(this.player.getName() + " was kicked for floating too long!"); + this.disconnect("Flying is not enabled on this server"); + return; + } + } + } + else + { + this.f = 0; + } + + this.player.onGround = packetplayinflying.i(); + this.minecraftServer.getPlayerList().d(this.player); + this.player.b(this.player.locY - d0, packetplayinflying.i()); + } + else if (this.e % 20 == 0) + { + this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch); + } + } + } + + public void a(double d0, double d1, double d2, float f, float f1) + { + // CraftBukkit start - Delegate to teleport(Location) + Player player = this.getPlayer(); + Location from = player.getLocation(); + Location to = new Location(this.getPlayer().getWorld(), d0, d1, d2, f, f1); + PlayerTeleportEvent event = new PlayerTeleportEvent(player, from, to, PlayerTeleportEvent.TeleportCause.UNKNOWN); + this.server.getPluginManager().callEvent(event); + + from = event.getFrom(); + to = event.isCancelled() ? from : event.getTo(); + + this.teleport(to); + } + + public void teleport(Location dest) + { + double d0, d1, d2; + float f, f1; + + d0 = dest.getX(); + d1 = dest.getY(); + d2 = dest.getZ(); + f = dest.getYaw(); + f1 = dest.getPitch(); + + // TODO: make sure this is the best way to address this. + if (Float.isNaN(f)) + { + f = 0; + } + + if (Float.isNaN(f1)) + { + f1 = 0; + } + + this.lastPosX = d0; + this.lastPosY = d1; + this.lastPosZ = d2; + this.lastYaw = f; + this.lastPitch = f1; + this.justTeleported = true; + // CraftBukkit end + + this.checkMovement = false; + this.y = d0; + this.z = d1; + this.q = d2; + this.player.setLocation(d0, d1, d2, f, f1); + this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0, d1 + 1.6200000047683716D, d2, f, f1, + false)); + } + + public void a(PacketPlayInBlockDig packetplayinblockdig) + { + if (this.player.dead) + return; // CraftBukkit + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + this.player.w(); + if (packetplayinblockdig.g() == 4) + { + // CraftBukkit start + // If the ticks aren't the same then the count starts from 0 and we + // update the lastDropTick. + if (this.lastDropTick != MinecraftServer.currentTick) + { + this.dropCount = 0; + this.lastDropTick = MinecraftServer.currentTick; + } + else + { + // Else we increment the drop count and check the amount. + this.dropCount++; + if (this.dropCount >= 20) + { + this.c.warn(this.player.getName() + " dropped their items too quickly!"); + this.disconnect("You dropped your items too quickly (Hacking?)"); + return; + } + } + // CraftBukkit end + this.player.a(false); + } + else if (packetplayinblockdig.g() == 3) + { + this.player.a(true); + } + else if (packetplayinblockdig.g() == 5) + { + this.player.by(); + } + else + { + boolean flag = false; + + if (packetplayinblockdig.g() == 0) + { + flag = true; + } + + if (packetplayinblockdig.g() == 1) + { + flag = true; + } + + if (packetplayinblockdig.g() == 2) + { + flag = true; + } + + int i = packetplayinblockdig.c(); + int j = packetplayinblockdig.d(); + int k = packetplayinblockdig.e(); + + if (flag) + { + double d0 = this.player.locX - ((double) i + 0.5D); + double d1 = this.player.locY - ((double) j + 0.5D) + 1.5D; + double d2 = this.player.locZ - ((double) k + 0.5D); + double d3 = d0 * d0 + d1 * d1 + d2 * d2; + + if (d3 > 36.0D) + { + return; + } + + if (j >= this.minecraftServer.getMaxBuildHeight()) + { + return; + } + } + + if (packetplayinblockdig.g() == 0) + { + if (!this.minecraftServer.a(worldserver, i, j, k, this.player)) + { + this.player.playerInteractManager.dig(i, j, k, packetplayinblockdig.f()); + } + else + { + // CraftBukkit start + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, + packetplayinblockdig.f(), this.player.inventory.getItemInHand()); + this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver)); + // Update any tile entity data for this block + TileEntity tileentity = worldserver.getTileEntity(i, j, k); + if (tileentity != null) + { + this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); + } + // CraftBukkit end + } + } + else if (packetplayinblockdig.g() == 2) + { + this.player.playerInteractManager.a(i, j, k); + if (worldserver.getType(i, j, k).getMaterial() != Material.AIR) + { + this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver)); + } + } + else if (packetplayinblockdig.g() == 1) + { + this.player.playerInteractManager.c(i, j, k); + if (worldserver.getType(i, j, k).getMaterial() != Material.AIR) + { + this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver)); + } + } + } + } + + public void a(PacketPlayInBlockPlace packetplayinblockplace) + { + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + // CraftBukkit start + if (this.player.dead) + return; + + // This is a horrible hack needed because the client sends 2 packets on + // 'right mouse click' + // aimed at a block. We shouldn't need to get the second packet if the + // data is handled + // but we cannot know what the client will do, so we might still get it + // + // If the time between packets is small enough, and the 'signature' + // similar, we discard the + // second one. This sadly has to remain until Mojang makes their packets + // saner. :( + // -- Grum + if (packetplayinblockplace.getFace() == 255) + { + if (packetplayinblockplace.getItemStack() != null + && packetplayinblockplace.getItemStack().getItem() == this.lastMaterial && this.lastPacket != null + && packetplayinblockplace.timestamp - this.lastPacket < 100) + { + this.lastPacket = null; + return; + } + } + else + { + this.lastMaterial = packetplayinblockplace.getItemStack() == null ? null : packetplayinblockplace + .getItemStack().getItem(); + this.lastPacket = packetplayinblockplace.timestamp; + } + // CraftBukkit - if rightclick decremented the item, always send the + // update packet. */ + // this is not here for CraftBukkit's own functionality; rather it is to + // fix + // a notch bug where the item doesn't update correctly. + boolean always = false; + // CraftBukkit end + + ItemStack itemstack = this.player.inventory.getItemInHand(); + boolean flag = false; + int i = packetplayinblockplace.c(); + int j = packetplayinblockplace.d(); + int k = packetplayinblockplace.e(); + int l = packetplayinblockplace.getFace(); + + this.player.w(); + if (packetplayinblockplace.getFace() == 255) + { + if (itemstack == null) + { + return; + } + + // CraftBukkit start + int itemstackAmount = itemstack.count; + org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, + Action.RIGHT_CLICK_AIR, itemstack); + if (event.useItemInHand() != Event.Result.DENY) + { + this.player.playerInteractManager.useItem(this.player, this.player.world, itemstack); + } + + // CraftBukkit - notch decrements the counter by 1 in the above + // method with food, + // snowballs and so forth, but he does it in a place that doesn't + // cause the + // inventory update packet to get sent + always = (itemstack.count != itemstackAmount); + // CraftBukkit end + } + else if (packetplayinblockplace.d() >= this.minecraftServer.getMaxBuildHeight() - 1 + && (packetplayinblockplace.getFace() == 1 || packetplayinblockplace.d() >= this.minecraftServer + .getMaxBuildHeight())) + { + ChatMessage chatmessage = new ChatMessage("build.tooHigh", + new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight()) }); + + chatmessage.b().setColor(EnumChatFormat.RED); + this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage)); + flag = true; + } + else + { + // CraftBukkit start - Check if we can actually do something over + // this large a distance + Location eyeLoc = this.getPlayer().getEyeLocation(); + double reachDistance = NumberConversions.square(eyeLoc.getX() - i) + + NumberConversions.square(eyeLoc.getY() - j) + NumberConversions.square(eyeLoc.getZ() - k); + if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED + : SURVIVAL_PLACE_DISTANCE_SQUARED)) + { + return; + } + + this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, + packetplayinblockplace.h(), packetplayinblockplace.i(), packetplayinblockplace.j()); + // CraftBukkit end + + flag = true; + } + + if (flag) + { + this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver)); + if (l == 0) + { + --j; + } + + if (l == 1) + { + ++j; + } + + if (l == 2) + { + --k; + } + + if (l == 3) + { + ++k; + } + + if (l == 4) + { + --i; + } + + if (l == 5) + { + ++i; + } + + this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(i, j, k, worldserver)); + } + + itemstack = this.player.inventory.getItemInHand(); + if (itemstack != null && itemstack.count == 0) + { + this.player.inventory.items[this.player.inventory.itemInHandIndex] = null; + itemstack = null; + } + + if (itemstack == null || itemstack.n() == 0) + { + this.player.h = true; + this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack + .b(this.player.inventory.items[this.player.inventory.itemInHandIndex]); + Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, + this.player.inventory.itemInHandIndex); + + this.player.activeContainer.b(); + this.player.h = false; + // CraftBukkit - TODO CHECK IF NEEDED -- new if structure might not + // need 'always'. Kept it in for now, but may be able to remove in + // future + if (!ItemStack.matches(this.player.inventory.getItemInHand(), packetplayinblockplace.getItemStack()) + || always) + { + this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, + this.player.inventory.getItemInHand())); + } + } + } + + public void a(IChatBaseComponent ichatbasecomponent) + { + // CraftBukkit start - Rarely it would send a disconnect line twice + if (this.processedDisconnect) + { + return; + } + else + { + this.processedDisconnect = true; + } + // CraftBukkit end + c.info(this.player.getName() + " lost connection: " + ichatbasecomponent.c()); // CraftBukkit + // - + // Don't + // toString + // the + // component + this.minecraftServer.au(); + // CraftBukkit start - Replace vanilla quit message handling with our + // own. + /* + * ChatMessage chatmessage = new ChatMessage("multiplayer.player.left", + * new Object[] { this.player.getScoreboardDisplayName()}); + * + * chatmessage.b().setColor(EnumChatFormat.YELLOW); + * this.minecraftServer.getPlayerList().sendMessage(chatmessage); + */ + + this.player.n(); + String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); + if ((quitMessage != null) && (quitMessage.length() > 0)) + { + this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage)); + } + // CraftBukkit end + if (this.minecraftServer.L() && this.player.getName().equals(this.minecraftServer.K())) + { + c.info("Stopping singleplayer server as player logged out"); + this.minecraftServer.safeShutdown(); + } + } + + public void sendPacket(Packet packet) + { + if (packet instanceof PacketPlayOutChat) + { + PacketPlayOutChat packetplayoutchat = (PacketPlayOutChat) packet; + EnumChatVisibility enumchatvisibility = this.player.getChatFlags(); + + if (enumchatvisibility == EnumChatVisibility.HIDDEN) + { + return; + } + + if (enumchatvisibility == EnumChatVisibility.SYSTEM && !packetplayoutchat.d()) + { + return; + } + } + + // CraftBukkit start + if (packet == null) + { + return; + } + else if (packet instanceof PacketPlayOutSpawnPosition) + { + PacketPlayOutSpawnPosition packet6 = (PacketPlayOutSpawnPosition) packet; + this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z); + } + // CraftBukkit end + + try + { + PacketVerifier.processPacket(packet, this.networkManager); + } + catch (Throwable throwable) + { + CrashReport crashreport = CrashReport.a(throwable, "Sending packet"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent"); + + crashreportsystemdetails.a("Packet class", (Callable) (new CrashReportConnectionPacketClass(this, packet))); + throw new ReportedException(crashreport); + } + } + + public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) + { + // CraftBukkit start + if (this.player.dead) + return; + + if (packetplayinhelditemslot.c() >= 0 && packetplayinhelditemslot.c() < PlayerInventory.getHotbarSize()) + { + PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), + this.player.inventory.itemInHandIndex, packetplayinhelditemslot.c()); + this.server.getPluginManager().callEvent(event); + if (event.isCancelled()) + { + this.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); + this.player.w(); + return; + } + // CraftBukkit end + + this.player.inventory.itemInHandIndex = packetplayinhelditemslot.c(); + this.player.w(); + } + else + { + c.warn(this.player.getName() + " tried to set an invalid carried item"); + this.disconnect("Nope!"); // CraftBukkit + } + } + + public void a(PacketPlayInChat packetplayinchat) + { + if (this.player.dead || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) + { // CraftBukkit - dead men tell no tales + ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); + + chatmessage.b().setColor(EnumChatFormat.RED); + this.sendPacket(new PacketPlayOutChat(chatmessage)); + } + else + { + this.player.w(); + String s = packetplayinchat.c(); + + s = StringUtils.normalizeSpace(s); + + for (int i = 0; i < s.length(); ++i) + { + if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) + { + // CraftBukkit start - threadsafety + if (packetplayinchat.a()) + { + Waitable waitable = new Waitable() + { + @Override + protected Object evaluate() + { + PlayerConnection.this.disconnect("Illegal characters in chat"); + return null; + } + }; + + this.minecraftServer.processQueue.add(waitable); + + try + { + waitable.get(); + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); + } + catch (ExecutionException e) + { + throw new RuntimeException(e); + } + } + else + { + this.disconnect("Illegal characters in chat"); + } + // CraftBukkit end + return; + } + } + + if (s.startsWith("/")) + { + // CraftBukkit start + try + { + this.minecraftServer.server.playerCommandState = true; + this.handleCommand(s); + } + finally + { + this.minecraftServer.server.playerCommandState = false; + } + } + else if (s.isEmpty()) + { + c.warn(this.player.getName() + " tried to send an empty message"); + } + else if (getPlayer().isConversing()) + { + getPlayer().acceptConversationInput(s); + } + else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) + { // Re-add "Command Only" flag check + ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); + + chatmessage.b().setColor(EnumChatFormat.RED); + this.sendPacket(new PacketPlayOutChat(chatmessage)); + } + else if (true) + { + this.chat(s, packetplayinchat.a()); + // CraftBukkit end - the below is for reference. :) + } + else + { + ChatMessage chatmessage1 = new ChatMessage("chat.type.text", new Object[] { + this.player.getScoreboardDisplayName(), s }); + + this.minecraftServer.getPlayerList().sendMessage(chatmessage1, false); + } + + // CraftBukkit start - replaced with thread safe throttle + // this.chatThrottle += 20; + if (chatSpamField.addAndGet(this, 20) > 200 + && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) + { + if (packetplayinchat.a()) + { + Waitable waitable = new Waitable() + { + @Override + protected Object evaluate() + { + PlayerConnection.this.disconnect("disconnect.spam"); + return null; + } + }; + + this.minecraftServer.processQueue.add(waitable); + + try + { + waitable.get(); + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); + } + catch (ExecutionException e) + { + throw new RuntimeException(e); + } + } + else + { + this.disconnect("disconnect.spam"); + } + // CraftBukkit end + } + } + } + + // CraftBukkit start + public void chat(String s, boolean async) + { + if (s.isEmpty() || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) + { + return; + } + + if (s.startsWith("/")) + { + this.handleCommand(s); + } + else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) + { + // Do nothing, this is coming from a plugin + } + else + { + Player player = this.getPlayer(); + AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet()); + this.server.getPluginManager().callEvent(event); + + if (PlayerChatEvent.getHandlerList().getRegisteredListeners().length != 0) + { + // Evil plugins still listening to deprecated event + final PlayerChatEvent queueEvent = new PlayerChatEvent(player, event.getMessage(), event.getFormat(), + event.getRecipients()); + queueEvent.setCancelled(event.isCancelled()); + Waitable waitable = new Waitable() + { + @Override + protected Object evaluate() + { + org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent); + + if (queueEvent.isCancelled()) + { + return null; + } + + String message = String.format(queueEvent.getFormat(), queueEvent.getPlayer().getDisplayName(), + queueEvent.getMessage()); + PlayerConnection.this.minecraftServer.console.sendMessage(message); + if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) + { + for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) + { + ((EntityPlayer) player).sendMessage(CraftChatMessage.fromString(message)); + } + } + else + { + for (Player player : queueEvent.getRecipients()) + { + player.sendMessage(message); + } + } + return null; + } + }; + if (async) + { + minecraftServer.processQueue.add(waitable); + } + else + { + waitable.run(); + } + try + { + waitable.get(); + } + catch (InterruptedException e) + { + Thread.currentThread().interrupt(); // This is proper habit + // for java. If we + // aren't handling it, + // pass it on! + } + catch (ExecutionException e) + { + throw new RuntimeException("Exception processing chat event", e.getCause()); + } + } + else + { + if (event.isCancelled()) + { + return; + } + + s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()); + minecraftServer.console.sendMessage(s); + if (((LazyPlayerSet) event.getRecipients()).isLazy()) + { + for (Object recipient : minecraftServer.getPlayerList().players) + { + ((EntityPlayer) recipient).sendMessage(CraftChatMessage.fromString(s)); + } + } + else + { + for (Player recipient : event.getRecipients()) + { + recipient.sendMessage(s); + } + } + } + } + } + + // CraftBukkit end + + private void handleCommand(String s) + { + // CraftBukkit start + CraftPlayer player = this.getPlayer(); + + PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet()); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + + try + { + this.c.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit + if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) + { + return; + } + } + catch (org.bukkit.command.CommandException ex) + { + player.sendMessage(org.bukkit.ChatColor.RED + + "An internal error occurred while attempting to perform this command"); + java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, + null, ex); + return; + } + // this.minecraftServer.getCommandHandler().a(this.player, s); + // CraftBukkit end + } + + public void a(PacketPlayInArmAnimation packetplayinarmanimation) + { + if (this.player.dead) + return; // CraftBukkit + this.player.w(); + if (packetplayinarmanimation.d() == 1) + { + // CraftBukkit start - Raytrace to look for 'rogue armswings' + float f = 1.0F; + float f1 = this.player.lastPitch + (this.player.pitch - this.player.lastPitch) * f; + float f2 = this.player.lastYaw + (this.player.yaw - this.player.lastYaw) * f; + double d0 = this.player.lastX + (this.player.locX - this.player.lastX) * (double) f; + double d1 = this.player.lastY + (this.player.locY - this.player.lastY) * (double) f + 1.62D + - (double) this.player.height; + double d2 = this.player.lastZ + (this.player.locZ - this.player.lastZ) * (double) f; + Vec3D vec3d = this.player.world.getVec3DPool().create(d0, d1, d2); + + float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F); + float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = 5.0D; + Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, true); + + if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.BLOCK) + { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, + this.player.inventory.getItemInHand()); + } + + // Arm swing animation + PlayerAnimationEvent event = new PlayerAnimationEvent(this.getPlayer()); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) + return; + // CraftBukkit end + + this.player.ba(); + } + } + + public void a(PacketPlayInEntityAction packetplayinentityaction) + { + // CraftBukkit start + if (this.player.dead) + return; + + this.player.w(); + if (packetplayinentityaction.d() == 1 || packetplayinentityaction.d() == 2) + { + PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), + packetplayinentityaction.d() == 1); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + } + + if (packetplayinentityaction.d() == 4 || packetplayinentityaction.d() == 5) + { + PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this.getPlayer(), + packetplayinentityaction.d() == 4); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return; + } + } + // CraftBukkit end + + if (packetplayinentityaction.d() == 1) + { + this.player.setSneaking(true); + } + else if (packetplayinentityaction.d() == 2) + { + this.player.setSneaking(false); + } + else if (packetplayinentityaction.d() == 4) + { + this.player.setSprinting(true); + } + else if (packetplayinentityaction.d() == 5) + { + this.player.setSprinting(false); + } + else if (packetplayinentityaction.d() == 3) + { + this.player.a(false, true, true); + // this.checkMovement = false; // CraftBukkit - this is handled in + // teleport + } + else if (packetplayinentityaction.d() == 6) + { + if (this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) + { + ((EntityHorse) this.player.vehicle).w(packetplayinentityaction.e()); + } + } + else if (packetplayinentityaction.d() == 7 && this.player.vehicle != null + && this.player.vehicle instanceof EntityHorse) + { + ((EntityHorse) this.player.vehicle).g(this.player); + } + } + + public void a(PacketPlayInUseEntity packetplayinuseentity) + { + if (this.player.dead) + return; // CraftBukkit + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + Entity entity = packetplayinuseentity.a((World) worldserver); + + this.player.w(); + if (entity != null) + { + boolean flag = this.player.o(entity); + double d0 = 36.0D; + + if (!flag) + { + d0 = 9.0D; + } + + if (this.player.e(entity) < d0) + { + ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit + if (packetplayinuseentity.c() == EnumEntityUseAction.INTERACT) + { + // CraftBukkit start + boolean triggerTagUpdate = itemInHand != null && itemInHand.getItem() == Items.NAME_TAG + && entity instanceof EntityInsentient; + boolean triggerChestUpdate = itemInHand != null + && itemInHand.getItem() == Item.getItemOf(Blocks.CHEST) && entity instanceof EntityHorse; + boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEASH + && entity instanceof EntityInsentient; + PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) this.getPlayer(), + entity.getBukkitEntity()); + this.server.getPluginManager().callEvent(event); + + if (triggerLeashUpdate + && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory + .getItemInHand().getItem() != Items.LEASH)) + { + // Refresh the current leash state + this.sendPacket(new PacketPlayOutAttachEntity(1, entity, ((EntityInsentient) entity) + .getLeashHolder())); + } + + if (triggerTagUpdate + && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory + .getItemInHand().getItem() != Items.NAME_TAG)) + { + // Refresh the current entity metadata + this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); + } + if (triggerChestUpdate + && (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory + .getItemInHand().getItem() != Item.getItemOf(Blocks.CHEST))) + { + this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); + } + + if (event.isCancelled()) + { + return; + } + // CraftBukkit end + + this.player.p(entity); + + // CraftBukkit start + if (itemInHand != null && itemInHand.count <= -1) + { + this.player.updateInventory(this.player.activeContainer); + } + // CraftBukkit end + } + else if (packetplayinuseentity.c() == EnumEntityUseAction.ATTACK) + { + if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb + || entity instanceof EntityArrow || entity == this.player) + { + this.disconnect("Attempting to attack an invalid entity"); + this.minecraftServer.warning("Player " + this.player.getName() + + " tried to attack an invalid entity"); + return; + } + + this.player.attack(entity); + + // CraftBukkit start + if (itemInHand != null && itemInHand.count <= -1) + { + this.player.updateInventory(this.player.activeContainer); + } + // CraftBukkit end + } + } + } + } + + public void a(PacketPlayInClientCommand packetplayinclientcommand) + { + this.player.w(); + EnumClientCommand enumclientcommand = packetplayinclientcommand.c(); + + switch (ClientCommandOrdinalWrapper.a[enumclientcommand.ordinal()]) + { + case 1: + if (this.player.viewingCredits) + { + this.minecraftServer.getPlayerList().changeDimension(this.player, 0, + PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit + // - + // reroute + // logic + // through + // custom + // portal + // management + } + else if (this.player.r().getWorldData().isHardcore()) + { + if (this.minecraftServer.L() && this.player.getName().equals(this.minecraftServer.K())) + { + this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); + this.minecraftServer.S(); + } + else + { + BanEntry banentry = new BanEntry(this.player.getName()); + + banentry.setReason("Death in Hardcore"); + this.minecraftServer.getPlayerList().getNameBans().add(banentry); + this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); + } + } + else + { + if (this.player.getHealth() > 0.0F) + { + return; + } + + this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, false); + } + break; + + case 2: + this.player.x().a(this.player); + break; + + case 3: + this.player.a((Statistic) AchievementList.f); + } + } + + public void a(PacketPlayInCloseWindow packetplayinclosewindow) + { + if (this.player.dead) + return; // CraftBukkit + + if (packetplayinclosewindow.a == player.activeContainer.windowId) + { + CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit + + this.player.m(); + } + } + + public void a(PacketPlayInWindowClick packetplayinwindowclick) + { + if (this.player.dead) + return; // CraftBukkit + + this.player.w(); + if (this.player.activeContainer.windowId == packetplayinwindowclick.c() + && this.player.activeContainer.c(this.player)) + { + // CraftBukkit start - Call InventoryClickEvent + if (packetplayinwindowclick.d() < -1 && packetplayinwindowclick.d() != -999) + { + return; + } + + InventoryView inventory = this.player.activeContainer.getBukkitView(); + SlotType type = CraftInventoryView.getSlotType(inventory, packetplayinwindowclick.d()); + + InventoryClickEvent event = null; + ClickType click = ClickType.UNKNOWN; + InventoryAction action = InventoryAction.UNKNOWN; + + ItemStack itemstack = null; + + if (packetplayinwindowclick.d() == -1) + { + type = SlotType.OUTSIDE; // override + click = packetplayinwindowclick.e() == 0 ? ClickType.WINDOW_BORDER_LEFT : ClickType.WINDOW_BORDER_RIGHT; + action = InventoryAction.NOTHING; + } + else if (packetplayinwindowclick.h() == 0) + { + if (packetplayinwindowclick.e() == 0) + { + click = ClickType.LEFT; + } + else if (packetplayinwindowclick.e() == 1) + { + click = ClickType.RIGHT; + } + if (packetplayinwindowclick.e() == 0 || packetplayinwindowclick.e() == 1) + { + action = InventoryAction.NOTHING; // Don't want to repeat + // ourselves + if (packetplayinwindowclick.d() == -999) + { + if (player.inventory.getCarried() != null) + { + action = packetplayinwindowclick.e() == 0 ? InventoryAction.DROP_ALL_CURSOR + : InventoryAction.DROP_ONE_CURSOR; + } + } + else + { + Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d()); + if (slot != null) + { + ItemStack clickedItem = slot.getItem(); + ItemStack cursor = player.inventory.getCarried(); + if (clickedItem == null) + { + if (cursor != null) + { + action = packetplayinwindowclick.e() == 0 ? InventoryAction.PLACE_ALL + : InventoryAction.PLACE_ONE; + } + } + else if (slot.a(player)) + { // Should be Slot.isPlayerAllowed + if (cursor == null) + { + action = packetplayinwindowclick.e() == 0 ? InventoryAction.PICKUP_ALL + : InventoryAction.PICKUP_HALF; + } + else if (slot.isAllowed(cursor)) + { // Should be Slot.isItemAllowed + if (clickedItem.doMaterialsMatch(cursor) && ItemStack.equals(clickedItem, cursor)) + { + int toPlace = packetplayinwindowclick.e() == 0 ? cursor.count : 1; + toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.count); + toPlace = Math.min(toPlace, slot.inventory.getMaxStackSize() + - clickedItem.count); + if (toPlace == 1) + { + action = InventoryAction.PLACE_ONE; + } + else if (toPlace == cursor.count) + { + action = InventoryAction.PLACE_ALL; + } + else if (toPlace < 0) + { + action = toPlace != -1 ? InventoryAction.PICKUP_SOME + : InventoryAction.PICKUP_ONE; // this + // happens + // with + // oversized + // stacks + } + else if (toPlace != 0) + { + action = InventoryAction.PLACE_SOME; + } + } + else if (cursor.count <= slot.a()) + { // Should be Slot.getMaxStackSize() + action = InventoryAction.SWAP_WITH_CURSOR; + } + } + else if (cursor.getItem() == clickedItem.getItem() + && (!cursor.usesData() || cursor.getData() == clickedItem.getData()) + && ItemStack.equals(cursor, clickedItem)) + { + if (clickedItem.count >= 0) + { + if (clickedItem.count + cursor.count <= cursor.getMaxStackSize()) + { + // As of 1.5, this is result slots + // only + action = InventoryAction.PICKUP_ALL; + } + } + } + } + } + } + } + } + else if (packetplayinwindowclick.h() == 1) + { + if (packetplayinwindowclick.e() == 0) + { + click = ClickType.SHIFT_LEFT; + } + else if (packetplayinwindowclick.e() == 1) + { + click = ClickType.SHIFT_RIGHT; + } + if (packetplayinwindowclick.e() == 0 || packetplayinwindowclick.e() == 1) + { + if (packetplayinwindowclick.d() < 0) + { + action = InventoryAction.NOTHING; + } + else + { + Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d()); + if (slot != null && slot.a(this.player) && slot.e()) + { // Should be Slot.hasItem() + action = InventoryAction.MOVE_TO_OTHER_INVENTORY; + } + else + { + action = InventoryAction.NOTHING; + } + } + } + } + else if (packetplayinwindowclick.h() == 2) + { + if (packetplayinwindowclick.e() >= 0 && packetplayinwindowclick.e() < 9) + { + click = ClickType.NUMBER_KEY; + Slot clickedSlot = this.player.activeContainer.getSlot(packetplayinwindowclick.d()); + if (clickedSlot.a(player)) + { + ItemStack hotbar = this.player.inventory.getItem(packetplayinwindowclick.e()); + boolean canCleanSwap = hotbar == null + || (clickedSlot.inventory == player.inventory && clickedSlot.isAllowed(hotbar)); // the + // slot + // will + // accept + // the + // hotbar + // item + if (clickedSlot.e()) + { + if (canCleanSwap) + { + action = InventoryAction.HOTBAR_SWAP; + } + else + { + int firstEmptySlot = player.inventory.j(); // Should + // be + // Inventory.firstEmpty() + if (firstEmptySlot > -1) + { + action = InventoryAction.HOTBAR_MOVE_AND_READD; + } + else + { + action = InventoryAction.NOTHING; // This is + // not + // sane! + // Mojang: + // You + // should + // test + // for + // other + // slots + // of + // same + // type + } + } + } + else if (!clickedSlot.e() && hotbar != null && clickedSlot.isAllowed(hotbar)) + { + action = InventoryAction.HOTBAR_SWAP; + } + else + { + action = InventoryAction.NOTHING; + } + } + else + { + action = InventoryAction.NOTHING; + } + // Special constructor for number key + event = new InventoryClickEvent(inventory, type, packetplayinwindowclick.d(), click, action, + packetplayinwindowclick.e()); + } + } + else if (packetplayinwindowclick.h() == 3) + { + if (packetplayinwindowclick.e() == 2) + { + click = ClickType.MIDDLE; + if (packetplayinwindowclick.d() == -999) + { + action = InventoryAction.NOTHING; + } + else + { + Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d()); + if (slot != null && slot.e() && player.abilities.canInstantlyBuild + && player.inventory.getCarried() == null) + { + action = InventoryAction.CLONE_STACK; + } + else + { + action = InventoryAction.NOTHING; + } + } + } + else + { + click = ClickType.UNKNOWN; + action = InventoryAction.UNKNOWN; + } + } + else if (packetplayinwindowclick.h() == 4) + { + if (packetplayinwindowclick.d() >= 0) + { + if (packetplayinwindowclick.e() == 0) + { + click = ClickType.DROP; + Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d()); + if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null + && slot.getItem().getItem() != Item.getItemOf(Blocks.AIR)) + { + action = InventoryAction.DROP_ONE_SLOT; + } + else + { + action = InventoryAction.NOTHING; + } + } + else if (packetplayinwindowclick.e() == 1) + { + click = ClickType.CONTROL_DROP; + Slot slot = this.player.activeContainer.getSlot(packetplayinwindowclick.d()); + if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null + && slot.getItem().getItem() != Item.getItemOf(Blocks.AIR)) + { + action = InventoryAction.DROP_ALL_SLOT; + } + else + { + action = InventoryAction.NOTHING; + } + } + } + else + { + // Sane default (because this happens when they are holding + // nothing. Don't ask why.) + click = ClickType.LEFT; + if (packetplayinwindowclick.e() == 1) + { + click = ClickType.RIGHT; + } + action = InventoryAction.NOTHING; + } + } + else if (packetplayinwindowclick.h() == 5) + { + itemstack = this.player.activeContainer.clickItem(packetplayinwindowclick.d(), + packetplayinwindowclick.e(), 5, this.player); + } + else if (packetplayinwindowclick.h() == 6) + { + click = ClickType.DOUBLE_CLICK; + action = InventoryAction.NOTHING; + if (packetplayinwindowclick.d() >= 0 && this.player.inventory.getCarried() != null) + { + ItemStack cursor = this.player.inventory.getCarried(); + action = InventoryAction.NOTHING; + // Quick check for if we have any of the item + if (inventory.getTopInventory().contains(org.bukkit.Material.getMaterial(Item.b(cursor.getItem()))) + || inventory.getBottomInventory().contains( + org.bukkit.Material.getMaterial(Item.b(cursor.getItem())))) + { + action = InventoryAction.COLLECT_TO_CURSOR; + } + } + } + // TODO check on updates + + if (packetplayinwindowclick.h() != 5) + { + if (click == ClickType.NUMBER_KEY) + { + event = new InventoryClickEvent(inventory, type, packetplayinwindowclick.d(), click, action, + packetplayinwindowclick.e()); + } + else + { + event = new InventoryClickEvent(inventory, type, packetplayinwindowclick.d(), click, action); + } + + org.bukkit.inventory.Inventory top = inventory.getTopInventory(); + if (packetplayinwindowclick.d() == 0 && top instanceof CraftingInventory) + { + org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe(); + if (recipe != null) + { + if (click == ClickType.NUMBER_KEY) + { + event = new CraftItemEvent(recipe, inventory, type, packetplayinwindowclick.d(), click, + action, packetplayinwindowclick.e()); + } + else + { + event = new CraftItemEvent(recipe, inventory, type, packetplayinwindowclick.d(), click, + action); + } + } + } + + server.getPluginManager().callEvent(event); + + switch (event.getResult()) + { + case ALLOW: + case DEFAULT: + itemstack = this.player.activeContainer.clickItem(packetplayinwindowclick.d(), + packetplayinwindowclick.e(), packetplayinwindowclick.h(), this.player); + break; + case DENY: + /* + * Needs enum constructor in InventoryAction if + * (action.modifiesOtherSlots()) { + * + * } else { if (action.modifiesCursor()) { + * this.player.playerConnection.sendPacket(new + * Packet103SetSlot(-1, -1, + * this.player.inventory.getCarried())); } if + * (action.modifiesClicked()) { + * this.player.playerConnection.sendPacket(new + * Packet103SetSlot(this.player.activeContainer.windowId, + * packet102windowclick.slot, + * this.player.activeContainer.getSlot + * (packet102windowclick.slot).getItem())); } } + */ + switch (action) + { + // Modified other slots + case PICKUP_ALL: + case MOVE_TO_OTHER_INVENTORY: + case HOTBAR_MOVE_AND_READD: + case HOTBAR_SWAP: + case COLLECT_TO_CURSOR: + case UNKNOWN: + this.player.updateInventory(this.player.activeContainer); + break; + // Modified cursor and clicked + case PICKUP_SOME: + case PICKUP_HALF: + case PICKUP_ONE: + case PLACE_ALL: + case PLACE_SOME: + case PLACE_ONE: + case SWAP_WITH_CURSOR: + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventory + .getCarried())); + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot( + this.player.activeContainer.windowId, packetplayinwindowclick.d(), + this.player.activeContainer.getSlot(packetplayinwindowclick.d()).getItem())); + break; + // Modified clicked only + case DROP_ALL_SLOT: + case DROP_ONE_SLOT: + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot( + this.player.activeContainer.windowId, packetplayinwindowclick.d(), + this.player.activeContainer.getSlot(packetplayinwindowclick.d()).getItem())); + break; + // Modified cursor only + case DROP_ALL_CURSOR: + case DROP_ONE_CURSOR: + case CLONE_STACK: + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.player.inventory + .getCarried())); + break; + // Nothing + case NOTHING: + break; + } + return; + } + } + // CraftBukkit end + + if (ItemStack.matches(packetplayinwindowclick.g(), itemstack)) + { + this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.c(), + packetplayinwindowclick.f(), true)); + this.player.h = true; + this.player.activeContainer.b(); + this.player.broadcastCarriedItem(); + this.player.h = false; + } + else + { + this.n.a(this.player.activeContainer.windowId, Short.valueOf(packetplayinwindowclick.f())); + this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.c(), + packetplayinwindowclick.f(), false)); + this.player.activeContainer.a(this.player, false); + ArrayList arraylist = new ArrayList(); + + for (int i = 0; i < this.player.activeContainer.c.size(); ++i) + { + arraylist.add(((Slot) this.player.activeContainer.c.get(i)).getItem()); + } + + this.player.a(this.player.activeContainer, arraylist); + + // CraftBukkit start - Send a Set Slot to update the crafting + // result slot + if (type == SlotType.RESULT && itemstack != null) + { + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot( + this.player.activeContainer.windowId, 0, itemstack)); + } + // CraftBukkit end + } + } + } + + public void a(PacketPlayInEnchantItem packetplayinenchantitem) + { + this.player.w(); + if (this.player.activeContainer.windowId == packetplayinenchantitem.c() + && this.player.activeContainer.c(this.player)) + { + this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.d()); + this.player.activeContainer.b(); + } + } + + public void a(PacketPlayInSetCreativeSlot packetplayinsetcreativeslot) + { + if (this.player.playerInteractManager.isCreative()) + { + boolean flag = packetplayinsetcreativeslot.c() < 0; + ItemStack itemstack = packetplayinsetcreativeslot.d(); + boolean flag1 = packetplayinsetcreativeslot.c() >= 1 + && packetplayinsetcreativeslot.c() < 36 + PlayerInventory.getHotbarSize(); + // CraftBukkit - Add invalidItems check + boolean flag2 = itemstack == null || itemstack.getItem() != null + && !invalidItems.contains(Item.b(itemstack.getItem())); + boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 + && itemstack.count > 0; + + // CraftBukkit start - Call click event + if (flag + || (flag1 && !ItemStack.matches( + this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.c()).getItem(), + packetplayinsetcreativeslot.d()))) + { // Insist on valid slot + + org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity(); + InventoryView inventory = new CraftInventoryView(player, player.getInventory(), + this.player.defaultContainer); + org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packetplayinsetcreativeslot.d()); // Should + // be + // packet107setcreativeslot.newitem + + SlotType type = SlotType.QUICKBAR; + if (flag) + { + type = SlotType.OUTSIDE; + } + else if (packetplayinsetcreativeslot.c() < 36) + { + if (packetplayinsetcreativeslot.c() >= 5 && packetplayinsetcreativeslot.c() < 9) + { + type = SlotType.ARMOR; + } + else + { + type = SlotType.CONTAINER; + } + } + InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 + : packetplayinsetcreativeslot.c(), item); + server.getPluginManager().callEvent(event); + + itemstack = CraftItemStack.asNMSCopy(event.getCursor()); + + switch (event.getResult()) + { + case ALLOW: + // Plugin cleared the id / stacksize checks + flag2 = flag3 = true; + break; + case DEFAULT: + break; + case DENY: + // Reset the slot + if (packetplayinsetcreativeslot.c() >= 0) + { + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot( + this.player.defaultContainer.windowId, packetplayinsetcreativeslot.c(), + this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.c()).getItem())); + this.player.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, null)); + } + return; + } + } + // CraftBukkit end + + if (flag1 && flag2 && flag3) + { + if (itemstack == null) + { + this.player.defaultContainer.setItem(packetplayinsetcreativeslot.c(), (ItemStack) null); + } + else + { + this.player.defaultContainer.setItem(packetplayinsetcreativeslot.c(), itemstack); + } + + this.player.defaultContainer.a(this.player, true); + } + else if (flag && flag2 && flag3 && this.x < 200) + { + this.x += 20; + EntityItem entityitem = this.player.drop(itemstack, true); + + if (entityitem != null) + { + entityitem.e(); + } + } + } + } + + public void a(PacketPlayInTransaction packetplayintransaction) + { + if (this.player.dead) + return; // CraftBukkit + Short oshort = (Short) this.n.get(this.player.activeContainer.windowId); + + if (oshort != null && packetplayintransaction.d() == oshort.shortValue() + && this.player.activeContainer.windowId == packetplayintransaction.c() + && !this.player.activeContainer.c(this.player)) + { + this.player.activeContainer.a(this.player, true); + } + } + + public void a(PacketPlayInUpdateSign packetplayinupdatesign) + { + if (this.player.dead) + return; // CraftBukkit + + this.player.w(); + WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); + + if (worldserver.isLoaded(packetplayinupdatesign.c(), packetplayinupdatesign.d(), packetplayinupdatesign.e())) + { + TileEntity tileentity = worldserver.getTileEntity(packetplayinupdatesign.c(), packetplayinupdatesign.d(), + packetplayinupdatesign.e()); + + if (tileentity instanceof TileEntitySign) + { + TileEntitySign tileentitysign = (TileEntitySign) tileentity; + + if (!tileentitysign.a() || tileentitysign.b() != this.player) + { + this.minecraftServer.warning("Player " + this.player.getName() + + " just tried to change non-editable sign"); + this.sendPacket(new PacketPlayOutUpdateSign(packetplayinupdatesign.c(), packetplayinupdatesign.d(), + packetplayinupdatesign.e(), tileentitysign.lines)); // CraftBukkit + return; + } + } + + int i; + int j; + + for (j = 0; j < 4; ++j) + { + boolean flag = true; + + if (packetplayinupdatesign.f()[j].length() > 15) + { + flag = false; + } + else + { + for (i = 0; i < packetplayinupdatesign.f()[j].length(); ++i) + { + if (!SharedConstants.isAllowedChatCharacter(packetplayinupdatesign.f()[j].charAt(i))) + { + flag = false; + } + } + } + + if (!flag) + { + packetplayinupdatesign.f()[j] = "!?"; + } + } + + if (tileentity instanceof TileEntitySign) + { + j = packetplayinupdatesign.c(); + int k = packetplayinupdatesign.d(); + + i = packetplayinupdatesign.e(); + TileEntitySign tileentitysign1 = (TileEntitySign) tileentity; + + // CraftBukkit start + Player player = this.server.getPlayer(this.player); + SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.v1_7_R1.block.CraftBlock) player + .getWorld().getBlockAt(j, k, i), this.server.getPlayer(this.player), packetplayinupdatesign.f()); + this.server.getPluginManager().callEvent(event); + + if (!event.isCancelled()) + { + for (int l = 0; l < 4; ++l) + { + tileentitysign1.lines[l] = event.getLine(l); + if (tileentitysign1.lines[l] == null) + { + tileentitysign1.lines[l] = ""; + } + } + tileentitysign1.isEditable = false; + } + // System.arraycopy(packetplayinupdatesign.f(), 0, + // tileentitysign1.lines, 0, 4); + // CraftBukkit end + + tileentitysign1.update(); + worldserver.notify(j, k, i); + } + } + } + + public void a(PacketPlayInKeepAlive packetplayinkeepalive) + { + if (packetplayinkeepalive.c() == this.h) + { + int i = (int) (this.d() - this.i); + + this.player.ping = (this.player.ping * 3 + i) / 4; + } + } + + private long d() + { + return System.nanoTime() / 1000000L; + } + + public void a(PacketPlayInAbilities packetplayinabilities) + { + // CraftBukkit start - d() should be isFlying() + if (this.player.abilities.canFly && this.player.abilities.isFlying != packetplayinabilities.d()) + { + PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), + packetplayinabilities.d()); + this.server.getPluginManager().callEvent(event); + if (!event.isCancelled()) + { + this.player.abilities.isFlying = packetplayinabilities.d(); // Actually + // set + // the + // player's + // flying + // status + } + else + { + this.player.updateAbilities(); // Tell the player their ability + // was reverted + } + } + // CraftBukkit end + } + + public void a(PacketPlayInTabComplete packetplayintabcomplete) + { + ArrayList arraylist = Lists.newArrayList(); + Iterator iterator = this.minecraftServer.a(this.player, packetplayintabcomplete.c()).iterator(); + + while (iterator.hasNext()) + { + String s = (String) iterator.next(); + + arraylist.add(s); + } + + this.player.playerConnection.sendPacket(new PacketPlayOutTabComplete((String[]) arraylist + .toArray(new String[arraylist.size()]))); + } + + public void a(PacketPlayInSettings packetplayinsettings) + { + this.player.a(packetplayinsettings); + } + + public void a(PacketPlayInCustomPayload packetplayincustompayload) + { + ItemStack itemstack; + ItemStack itemstack1; + + // CraftBukkit start - Ignore empty payloads + if (packetplayincustompayload.length <= 0) + { + return; + } + // CraftBukkit end + + if ("MC|BEdit".equals(packetplayincustompayload.c())) + { + try + { + itemstack = (new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()))).c(); + if (!ItemBookAndQuill.a(itemstack.getTag())) + { + throw new IOException("Invalid book tag!"); + } + + itemstack1 = this.player.inventory.getItemInHand(); + if (itemstack.getItem() == Items.BOOK_AND_QUILL && itemstack.getItem() == itemstack1.getItem()) + { + CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit + } + // CraftBukkit start + } + catch (Exception exception) + { + c.error("Couldn\'t handle book info", exception); + this.disconnect("Invalid book data!"); + // CraftBukkit end + } + } + else if ("MC|BSign".equals(packetplayincustompayload.c())) + { + try + { + itemstack = (new PacketDataSerializer(Unpooled.wrappedBuffer(packetplayincustompayload.e()))).c(); + if (!ItemWrittenBook.a(itemstack.getTag())) + { + throw new IOException("Invalid book tag!"); + } + + itemstack1 = this.player.inventory.getItemInHand(); + if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.BOOK_AND_QUILL) + { + CraftEventFactory.handleEditBookEvent(player, itemstack); // CraftBukkit + } + // CraftBukkit start + } + catch (Exception exception1) + { + c.error("Couldn\'t sign book", exception1); + this.disconnect("Invalid book data!"); + // CraftBukkit end + } + } + else + { + DataInputStream datainputstream; + int i; + + if ("MC|TrSel".equals(packetplayincustompayload.c())) + { + try + { + datainputstream = new DataInputStream(new ByteArrayInputStream(packetplayincustompayload.e())); + i = datainputstream.readInt(); + Container container = this.player.activeContainer; + + if (container instanceof ContainerMerchant) + { + ((ContainerMerchant) container).e(i); + } + } + catch (Exception exception2) + { + // CraftBukkit start + c.error("Couldn\'t select trade", exception2); + this.disconnect("Invalid trade data!"); + // CraftBukkit end + } + } + else if ("MC|AdvCdm".equals(packetplayincustompayload.c())) + { + if (!this.minecraftServer.getEnableCommandBlock()) + { + this.player.sendMessage(new ChatMessage("advMode.notEnabled", new Object[0])); + } + else if (this.player.a(2, "") && this.player.abilities.canInstantlyBuild) + { + try + { + PacketDataSerializer packetdataserializer = new PacketDataSerializer( + Unpooled.wrappedBuffer(packetplayincustompayload.e())); + byte b0 = packetdataserializer.readByte(); + CommandBlockListenerAbstract commandblocklistenerabstract = null; + + if (b0 == 0) + { + TileEntity tileentity = this.player.world.getTileEntity(packetdataserializer.readInt(), + packetdataserializer.readInt(), packetdataserializer.readInt()); + + if (tileentity instanceof TileEntityCommand) + { + commandblocklistenerabstract = ((TileEntityCommand) tileentity).a(); + } + } + else if (b0 == 1) + { + Entity entity = this.player.world.getEntity(packetdataserializer.readInt()); + + if (entity instanceof EntityMinecartCommandBlock) + { + commandblocklistenerabstract = ((EntityMinecartCommandBlock) entity).e(); + } + } + + String s = packetdataserializer.c(packetdataserializer.readableBytes()); + + if (commandblocklistenerabstract != null) + { + commandblocklistenerabstract.a(s); + commandblocklistenerabstract.e(); + this.player.sendMessage(new ChatMessage("advMode.setCommand.success", new Object[] { s })); + } + } + catch (Exception exception3) + { + // CraftBukkit start + c.error("Couldn\'t set command block", exception3); + this.disconnect("Invalid CommandBlock data!"); + // CraftBukkit end + } + } + else + { + this.player.sendMessage(new ChatMessage("advMode.notAllowed", new Object[0])); + } + } + else if ("MC|Beacon".equals(packetplayincustompayload.c())) + { + if (this.player.activeContainer instanceof ContainerBeacon) + { + try + { + datainputstream = new DataInputStream(new ByteArrayInputStream(packetplayincustompayload.e())); + i = datainputstream.readInt(); + int j = datainputstream.readInt(); + ContainerBeacon containerbeacon = (ContainerBeacon) this.player.activeContainer; + Slot slot = containerbeacon.getSlot(0); + + if (slot.e()) + { + slot.a(1); + TileEntityBeacon tileentitybeacon = containerbeacon.e(); + + tileentitybeacon.d(i); + tileentitybeacon.e(j); + tileentitybeacon.update(); + } + } + catch (Exception exception4) + { + // CraftBukkit start + c.error("Couldn\'t set beacon", exception4); + this.disconnect("Invalid beacon data!"); + // CraftBukkit end + } + } + } + else if ("MC|ItemName".equals(packetplayincustompayload.c()) + && this.player.activeContainer instanceof ContainerAnvil) + { + ContainerAnvil containeranvil = (ContainerAnvil) this.player.activeContainer; + + if (packetplayincustompayload.e() != null && packetplayincustompayload.e().length >= 1) + { + String s1 = SharedConstants.a(new String(packetplayincustompayload.e(), Charsets.UTF_8)); + + if (s1.length() <= 30) + { + containeranvil.a(s1); + } + } + else + { + containeranvil.a(""); + } + } + // CraftBukkit start + else if (packetplayincustompayload.c().equals("REGISTER")) + { + try + { + String channels = new String(packetplayincustompayload.e(), "UTF8"); + for (String channel : channels.split("\0")) + { + getPlayer().addChannel(channel); + } + } + catch (UnsupportedEncodingException ex) + { + throw new AssertionError(ex); + } + } + else if (packetplayincustompayload.c().equals("UNREGISTER")) + { + try + { + String channels = new String(packetplayincustompayload.e(), "UTF8"); + for (String channel : channels.split("\0")) + { + getPlayer().removeChannel(channel); + } + } + catch (UnsupportedEncodingException ex) + { + throw new AssertionError(ex); + } + } + else + { + server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.c(), + packetplayincustompayload.e()); + } + // CraftBukkit end + } + } + + public void a(EnumProtocol enumprotocol, EnumProtocol enumprotocol1) + { + if (enumprotocol1 != EnumProtocol.PLAY) + { + throw new IllegalStateException("Unexpected change in protocol!"); + } + } + + // CraftBukkit start - Add "isDisconnected" method + public final boolean isDisconnected() + { + return !NetworkManager.a(this.networkManager).config().isAutoRead(); + } + // CraftBukkit end +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerList.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerList.java similarity index 73% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerList.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerList.java index 96decdf9e..558921ba0 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/PlayerList.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/PlayerList.java @@ -1,6 +1,5 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; -import com.google.common.base.Charsets; import java.io.File; import java.net.SocketAddress; import java.text.SimpleDateFormat; @@ -13,54 +12,16 @@ import java.util.Map; import java.util.Set; import java.util.Map.Entry; -import net.minecraft.server.v1_6_R3.BanEntry; -import net.minecraft.server.v1_6_R3.BanList; -import net.minecraft.server.v1_6_R3.ChatMessage; -import net.minecraft.server.v1_6_R3.ChunkCoordinates; -import net.minecraft.server.v1_6_R3.DemoPlayerInteractManager; -import net.minecraft.server.v1_6_R3.Entity; -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.EntityTypes; -import net.minecraft.server.v1_6_R3.EnumGamemode; -import net.minecraft.server.v1_6_R3.INetworkManager; -import net.minecraft.server.v1_6_R3.IPlayerFileData; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.MinecraftServer; -import net.minecraft.server.v1_6_R3.MobEffect; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet16BlockItemSwitch; -import net.minecraft.server.v1_6_R3.Packet1Login; -import net.minecraft.server.v1_6_R3.Packet201PlayerInfo; -import net.minecraft.server.v1_6_R3.Packet202Abilities; -import net.minecraft.server.v1_6_R3.Packet209SetScoreboardTeam; -import net.minecraft.server.v1_6_R3.Packet250CustomPayload; -import net.minecraft.server.v1_6_R3.Packet3Chat; -import net.minecraft.server.v1_6_R3.Packet41MobEffect; -import net.minecraft.server.v1_6_R3.Packet43SetExperience; -import net.minecraft.server.v1_6_R3.Packet4UpdateTime; -import net.minecraft.server.v1_6_R3.Packet6SpawnPosition; -import net.minecraft.server.v1_6_R3.Packet70Bed; -import net.minecraft.server.v1_6_R3.Packet9Respawn; -import net.minecraft.server.v1_6_R3.PendingConnection; -import net.minecraft.server.v1_6_R3.PlayerChunkMap; -import net.minecraft.server.v1_6_R3.PlayerConnection; -import net.minecraft.server.v1_6_R3.PlayerDistanceComparator; -import net.minecraft.server.v1_6_R3.PlayerInteractManager; -import net.minecraft.server.v1_6_R3.Scoreboard; -import net.minecraft.server.v1_6_R3.ScoreboardObjective; -import net.minecraft.server.v1_6_R3.ScoreboardScore; -import net.minecraft.server.v1_6_R3.ScoreboardServer; -import net.minecraft.server.v1_6_R3.ScoreboardTeam; -import net.minecraft.server.v1_6_R3.ScoreboardTeamBase; -import net.minecraft.server.v1_6_R3.World; -import net.minecraft.server.v1_6_R3.WorldServer; +import net.minecraft.util.com.google.common.base.Charsets; +import net.minecraft.util.com.google.common.collect.Maps; +import net.minecraft.util.com.mojang.authlib.GameProfile; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; // CraftBukkit start -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.chunkio.ChunkIOExecutor; +import org.bukkit.craftbukkit.v1_7_R1.CraftServer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.chunkio.ChunkIOExecutor; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -78,27 +39,30 @@ import org.bukkit.util.Vector; public abstract class PlayerList { - private static final SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); + private static final Logger d = LogManager.getLogger(); + private static final SimpleDateFormat e = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); private final MinecraftServer server; public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety private final BanList banByName = new BanList(new File("banned-players.txt")); private final BanList banByIP = new BanList(new File("banned-ips.txt")); - private Set operators = new HashSet(); - private Set whitelist = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet + private final Set operators = new HashSet(); + private final Set whitelist = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet + private final Map k = Maps.newHashMap(); public IPlayerFileData playerFileData; // CraftBukkit - private -> public public boolean hasWhitelist; // CraftBukkit - private -> public protected int maxPlayers; protected int c; - private EnumGamemode l; - private boolean m; - private int n; + private EnumGamemode n; + private boolean o; + private int p; // CraftBukkit start private CraftServer cserver; public PlayerList(MinecraftServer minecraftserver) { minecraftserver.server = new CraftServer(minecraftserver, this); - minecraftserver.console = org.bukkit.craftbukkit.v1_6_R3.command.ColouredConsoleSender.getInstance(); + minecraftserver.console = org.bukkit.craftbukkit.v1_7_R1.command.ColouredConsoleSender.getInstance(); + minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.v1_7_R1.command.ConsoleCommandCompleter(minecraftserver.server)); this.cserver = minecraftserver.server; // CraftBukkit end @@ -108,47 +72,52 @@ public abstract class PlayerList { this.maxPlayers = 8; } - public void a(INetworkManager inetworkmanager, EntityPlayer entityplayer) { + public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { NBTTagCompound nbttagcompound = this.a(entityplayer); entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension)); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); String s = "local"; - if (inetworkmanager.getSocketAddress() != null) { - s = inetworkmanager.getSocketAddress().toString(); + if (networkmanager.getSocketAddress() != null) { + s = networkmanager.getSocketAddress().toString(); } - // CraftBukkit - add world and location to 'logged in' message. - this.server.getLogger().info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); + // CraftBukkit - add world to 'logged in' message. + d.info(entityplayer.getName() + "[" + s + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); this.a(entityplayer, (EntityPlayer) null, worldserver); - PlayerConnection playerconnection = new PlayerConnection(this.server, inetworkmanager, entityplayer); + PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer); // CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly. int maxPlayers = this.getMaxPlayers(); if (maxPlayers > 60) { maxPlayers = 60; } - playerconnection.sendPacket(new Packet1Login(entityplayer.id, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, worldserver.getHeight(), maxPlayers)); + playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), worldserver.getWorldData().isHardcore(), worldserver.worldProvider.dimension, worldserver.difficulty, maxPlayers, worldserver.getWorldData().getType())); entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit end - - playerconnection.sendPacket(new Packet250CustomPayload("MC|Brand", this.getServer().getServerModName().getBytes(Charsets.UTF_8))); - playerconnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z)); - playerconnection.sendPacket(new Packet202Abilities(entityplayer.abilities)); - playerconnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex)); + playerconnection.sendPacket(new PacketPlayOutCustomPayload("MC|Brand", this.getServer().getServerModName().getBytes(Charsets.UTF_8))); + playerconnection.sendPacket(new PacketPlayOutSpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z)); + playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities)); + playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); + entityplayer.x().d(); + entityplayer.x().b(entityplayer); this.a((ScoreboardServer) worldserver.getScoreboard(), entityplayer); - this.b(entityplayer, worldserver); - // this.sendMessage(ChatMessage.b("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName()}).a(EnumChatFormat.YELLOW)); // CraftBukkit - handled in event + this.server.au(); + /* CraftBukkit start - login message is handled in the event + ChatMessage chatmessage = new ChatMessage("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName()}); + + chatmessage.b().setColor(EnumChatFormat.YELLOW); + this.sendMessage(chatmessage); + // CraftBukkit end*/ this.c(entityplayer); playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); - this.server.ag().a(playerconnection); - playerconnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); - if (this.server.getTexturePack().length() > 0) { - entityplayer.a(this.server.getTexturePack(), this.server.U()); + this.b(entityplayer, worldserver); + if (this.server.getResourcePack().length() > 0) { + entityplayer.a(this.server.getResourcePack()); } Iterator iterator = entityplayer.getEffects().iterator(); @@ -156,18 +125,18 @@ public abstract class PlayerList { while (iterator.hasNext()) { MobEffect mobeffect = (MobEffect) iterator.next(); - playerconnection.sendPacket(new Packet41MobEffect(entityplayer.id, mobeffect)); + playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect)); } entityplayer.syncInventory(); - if (nbttagcompound != null && nbttagcompound.hasKey("Riding")) { + if (nbttagcompound != null && nbttagcompound.hasKeyOfType("Riding", 10)) { Entity entity = EntityTypes.a(nbttagcompound.getCompound("Riding"), worldserver); if (entity != null) { - entity.p = true; + entity.o = true; worldserver.addEntity(entity); entityplayer.mount(entity); - entity.p = false; + entity.o = false; } } } @@ -179,7 +148,7 @@ public abstract class PlayerList { while (iterator.hasNext()) { ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next(); - entityplayer.playerConnection.sendPacket(new Packet209SetScoreboardTeam(scoreboardteam, 0)); + entityplayer.playerConnection.sendPacket(new PacketPlayOutScoreboardTeam(scoreboardteam, 0)); } for (int i = 0; i < 3; ++i) { @@ -206,7 +175,7 @@ public abstract class PlayerList { } public void a(EntityPlayer entityplayer, WorldServer worldserver) { - WorldServer worldserver1 = entityplayer.p(); + WorldServer worldserver1 = entityplayer.r(); if (worldserver != null) { worldserver.getPlayerChunkMap().removePlayer(entityplayer); @@ -221,13 +190,14 @@ public abstract class PlayerList { } public NBTTagCompound a(EntityPlayer entityplayer) { - NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); // CraftBukkit + // CraftBukkit - fix reference to worldserver array + NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); NBTTagCompound nbttagcompound1; - if (entityplayer.getName().equals(this.server.J()) && nbttagcompound != null) { + if (entityplayer.getName().equals(this.server.K()) && nbttagcompound != null) { entityplayer.f(nbttagcompound); nbttagcompound1 = nbttagcompound; - System.out.println("loading single player"); + d.debug("loading single player"); } else { nbttagcompound1 = this.playerFileData.load(entityplayer); } @@ -237,22 +207,29 @@ public abstract class PlayerList { protected void b(EntityPlayer entityplayer) { this.playerFileData.save(entityplayer); + ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.k.get(entityplayer.getName()); + + if (serverstatisticmanager != null) { + serverstatisticmanager.b(); + } } public void c(EntityPlayer entityplayer) { cserver.detectListNameConflict(entityplayer); // CraftBukkit - // this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below + // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below this.players.add(entityplayer); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); // CraftBukkit start - PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " joined the game."); + PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " joined the game."); this.cserver.getPluginManager().callEvent(playerJoinEvent); String joinMessage = playerJoinEvent.getJoinMessage(); if ((joinMessage != null) && (joinMessage.length() > 0)) { - this.server.getPlayerList().sendAll(new Packet3Chat(ChatMessage.d(joinMessage))); + for (IChatBaseComponent line : org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage.fromString(joinMessage)) { + this.server.getPlayerList().sendAll(new PacketPlayOutChat(line)); + } } this.cserver.onPlayerJoin(playerJoinEvent.getPlayer()); @@ -267,7 +244,7 @@ public abstract class PlayerList { // CraftBukkit end // CraftBukkit start - sendAll above replaced with this loop - Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, true, 1000); + PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, true, 1000); for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); @@ -280,44 +257,47 @@ public abstract class PlayerList { for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); - // CraftBukkit start - .name -> .listName - if (entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) { - entityplayer.playerConnection.sendPacket(new Packet201PlayerInfo(entityplayer1.listName, true, entityplayer1.ping)); + // CraftBukkit start + if (!entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) { + continue; } + // .name -> .listName + entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(entityplayer1.listName, true, entityplayer1.ping)); // CraftBukkit end } } public void d(EntityPlayer entityplayer) { - entityplayer.p().getPlayerChunkMap().movePlayer(entityplayer); + entityplayer.r().getPlayerChunkMap().movePlayer(entityplayer); } public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string - if (entityplayer.playerConnection.disconnected) return null; // CraftBukkit - exploitsies fix + entityplayer.a(StatisticList.f); // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it - org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer); + org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.handleInventoryCloseEvent(entityplayer); - PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game."); + PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game."); this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); // CraftBukkit end - this.b(entityplayer); - WorldServer worldserver = entityplayer.p(); + WorldServer worldserver = entityplayer.r(); if (entityplayer.vehicle != null && !(entityplayer.vehicle instanceof EntityPlayer)) { // CraftBukkit - Don't remove players worldserver.removeEntity(entityplayer.vehicle); - // System.out.println("removing player mount"); // CraftBukkit - Removed debug message + d.debug("removing player mount"); } worldserver.kill(entityplayer); worldserver.getPlayerChunkMap().removePlayer(entityplayer); this.players.remove(entityplayer); + this.k.remove(entityplayer.getName()); ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit // CraftBukkit start - .name -> .listName, replace sendAll with loop - Packet201PlayerInfo packet = new Packet201PlayerInfo(entityplayer.listName, false, 9999); + // this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), false, 9999)); + PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(entityplayer.listName, false, 9999); for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); @@ -332,52 +312,56 @@ public abstract class PlayerList { // CraftBukkit end } - // CraftBukkit start - Whole method and signature - public EntityPlayer attemptLogin(PendingConnection pendingconnection, String s, String hostname) { + // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer + public EntityPlayer attemptLogin(LoginListener loginlistener, GameProfile gameprofile, String hostname) { // 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.O() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0))); + SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress(); + + EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, new PlayerInteractManager(this.server.getWorldServer(0))); Player player = entity.getBukkitEntity(); - PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, pendingconnection.getSocket().getInetAddress()); + PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress()); - SocketAddress socketaddress = pendingconnection.networkManager.getSocketAddress(); - - if (this.banByName.isBanned(s)) { - BanEntry banentry = (BanEntry) this.banByName.getEntries().get(s); - String s1 = "You are banned from this server!\nReason: " + banentry.getReason(); + if (this.banByName.isBanned(gameprofile.getName())) { + BanEntry banentry = (BanEntry) this.banByName.getEntries().get(gameprofile.getName()); + String s = "You are banned from this server!\nReason: " + banentry.getReason(); if (banentry.getExpires() != null) { - s1 = s1 + "\nYour ban will be removed on " + d.format(banentry.getExpires()); + s = s + "\nYour ban will be removed on " + e.format(banentry.getExpires()); } - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1); - } else if (!this.isWhitelisted(s)) { + // return s; + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s); + } else if (!this.isWhitelisted(gameprofile.getName())) { + // return "You are not white-listed on this server!"; event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, "You are not white-listed on this server!"); } else { - String s2 = socketaddress.toString(); + String s1 = socketaddress.toString(); - s2 = s2.substring(s2.indexOf("/") + 1); - s2 = s2.substring(0, s2.indexOf(":")); - if (this.banByIP.isBanned(s2)) { - BanEntry banentry1 = (BanEntry) this.banByIP.getEntries().get(s2); - String s3 = "Your IP address is banned from this server!\nReason: " + banentry1.getReason(); + s1 = s1.substring(s1.indexOf("/") + 1); + s1 = s1.substring(0, s1.indexOf(":")); + if (this.banByIP.isBanned(s1)) { + BanEntry banentry1 = (BanEntry) this.banByIP.getEntries().get(s1); + String s2 = "Your IP address is banned from this server!\nReason: " + banentry1.getReason(); if (banentry1.getExpires() != null) { - s3 = s3 + "\nYour ban will be removed on " + d.format(banentry1.getExpires()); + s2 = s2 + "\nYour ban will be removed on " + e.format(banentry1.getExpires()); } - event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s3); - } else if (this.players.size() >= this.maxPlayers) { - event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!"); + // return s2; + event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s2); } else { - event.disallow(PlayerLoginEvent.Result.ALLOWED, s2); + // return this.players.size() >= this.maxPlayers ? "The server is full!" : null; + if (this.players.size() >= this.maxPlayers) { + event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full!"); + } } } this.cserver.getPluginManager().callEvent(event); if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { - pendingconnection.disconnect(event.getKickMessage()); + loginlistener.disconnect(event.getKickMessage()); return null; } @@ -385,15 +369,14 @@ public abstract class PlayerList { // CraftBukkit end } - public EntityPlayer processLogin(EntityPlayer player) { // CraftBukkit - String -> EntityPlayer - String s = player.name; // CraftBukkit + public EntityPlayer processLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer ArrayList arraylist = new ArrayList(); EntityPlayer entityplayer; for (int i = 0; i < this.players.size(); ++i) { entityplayer = (EntityPlayer) this.players.get(i); - if (entityplayer.getName().equalsIgnoreCase(s)) { + if (entityplayer.getName().equalsIgnoreCase(gameprofile.getName())) { arraylist.add(entityplayer); } } @@ -408,14 +391,14 @@ public abstract class PlayerList { /* CraftBukkit start Object object; - if (this.server.O()) { + if (this.server.P()) { object = new DemoPlayerInteractManager(this.server.getWorldServer(0)); } else { object = new PlayerInteractManager(this.server.getWorldServer(0)); } - return new EntityPlayer(this.server, this.server.getWorldServer(0), s, (PlayerInteractManager) object); - */ + return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object); + // */ return player; // CraftBukkit end } @@ -427,22 +410,40 @@ public abstract class PlayerList { public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) { // CraftBukkit end - entityplayer.p().getTracker().untrackPlayer(entityplayer); - // entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit - entityplayer.p().getPlayerChunkMap().removePlayer(entityplayer); + entityplayer.r().getTracker().untrackPlayer(entityplayer); + // entityplayer.r().getTracker().untrackEntity(entityplayer); // CraftBukkit + entityplayer.r().getPlayerChunkMap().removePlayer(entityplayer); this.players.remove(entityplayer); this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer); ChunkCoordinates chunkcoordinates = entityplayer.getBed(); boolean flag1 = entityplayer.isRespawnForced(); - // CraftBukkit start + /* CraftBukkit start + entityplayer.dimension = i; + Object object; + + if (this.server.P()) { + object = new DemoPlayerInteractManager(this.server.getWorldServer(entityplayer.dimension)); + } else { + object = new PlayerInteractManager(this.server.getWorldServer(entityplayer.dimension)); + } + + EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object); + // */ EntityPlayer entityplayer1 = entityplayer; org.bukkit.World fromWorld = entityplayer1.getBukkitEntity().getWorld(); entityplayer1.viewingCredits = false; + // CraftBukkit end + + entityplayer1.playerConnection = entityplayer.playerConnection; entityplayer1.copyTo(entityplayer, flag); + entityplayer1.d(entityplayer.getId()); + // WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); // CraftBukkit - handled later + // this.a(entityplayer1, entityplayer, worldserver); // CraftBukkit - removed ChunkCoordinates chunkcoordinates1; + // CraftBukkit start if (location == null) { boolean isBedSpawn = false; CraftWorld cworld = (CraftWorld) this.server.server.getWorld(entityplayer.spawnWorld); @@ -453,7 +454,7 @@ public abstract class PlayerList { location = new Location(cworld, chunkcoordinates1.x + 0.5, chunkcoordinates1.y, chunkcoordinates1.z + 0.5); } else { entityplayer1.setRespawnPosition(null, true); - entityplayer1.playerConnection.sendPacket(new Packet70Bed(0, 0)); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(0, 0)); } } @@ -485,39 +486,50 @@ public abstract class PlayerList { // CraftBukkit start byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); // Force the client to refresh their chunk cache. - entityplayer1.playerConnection.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0), (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode())); - entityplayer1.playerConnection.sendPacket(new Packet9Respawn(actualDimension, (byte) worldserver.difficulty, worldserver.getWorldData().getType(), worldserver.getHeight(), entityplayer.playerInteractManager.getGameMode())); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn((byte) (actualDimension >= 0 ? -1 : 0), worldserver.difficulty, worldserver.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode())); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(actualDimension, worldserver.difficulty, worldserver.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode())); entityplayer1.spawnIn(worldserver); entityplayer1.dead = false; entityplayer1.playerConnection.teleport(new Location(worldserver.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch)); entityplayer1.setSneaking(false); chunkcoordinates1 = worldserver.getSpawn(); + // entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); // CraftBukkit end - entityplayer1.playerConnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z)); - entityplayer1.playerConnection.sendPacket(new Packet43SetExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(chunkcoordinates1.x, chunkcoordinates1.y, chunkcoordinates1.z)); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); this.b(entityplayer1, worldserver); - worldserver.getPlayerChunkMap().addPlayer(entityplayer1); - worldserver.addEntity(entityplayer1); - this.players.add(entityplayer1); - // CraftBukkit start - Added from changeDimension - this.updateClient(entityplayer1); // CraftBukkit + // CraftBukkit start + // Don't re-add player to player list if disconnected + if (!entityplayer.playerConnection.isDisconnected()) { + worldserver.getPlayerChunkMap().addPlayer(entityplayer1); + worldserver.addEntity(entityplayer1); + this.players.add(entityplayer1); + } + // Added from changeDimension + this.updateClient(entityplayer1); // Update health, etc... entityplayer1.updateAbilities(); Iterator iterator = entityplayer1.getEffects().iterator(); while (iterator.hasNext()) { MobEffect mobeffect = (MobEffect) iterator.next(); - entityplayer1.playerConnection.sendPacket(new Packet41MobEffect(entityplayer1.id, mobeffect)); + entityplayer1.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer1.getId(), mobeffect)); } // entityplayer1.syncInventory(); // CraftBukkit end entityplayer1.setHealth(entityplayer1.getHealth()); - // CraftBukkit start - Don't fire on respawn + // CraftBukkit start + // Don't fire on respawn if (fromWorld != location.getWorld()) { PlayerChangedWorldEvent event = new PlayerChangedWorldEvent((Player) entityplayer1.getBukkitEntity(), fromWorld); Bukkit.getServer().getPluginManager().callEvent(event); } + + // Save player file again if they were disconnected + if (entityplayer.playerConnection.isDisconnected()) { + this.b(entityplayer1); + } // CraftBukkit end return entityplayer1; @@ -526,22 +538,24 @@ public abstract class PlayerList { // CraftBukkit start - Replaced the standard handling of portals with a more customised method. public void changeDimension(EntityPlayer entityplayer, int i, TeleportCause cause) { WorldServer exitWorld = null; + if (entityplayer.dimension < CraftWorld.CUSTOM_DIMENSION_OFFSET) { // plugins must specify exit from custom Bukkit worlds // only target existing worlds (compensate for allow-nether/allow-end as false) + for (WorldServer world : this.server.worlds) { if (world.dimension == i) { exitWorld = world; } } } - + Location enter = entityplayer.getBukkitEntity().getLocation(); Location exit = null; boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END if (exitWorld != null) { if ((cause == TeleportCause.END_PORTAL) && (i == 0)) { // THE_END -> NORMAL; use bed if available, otherwise default spawn - exit = ((org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); + exit = ((org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) { exit = exitWorld.getWorld().getSpawnLocation(); } @@ -552,7 +566,7 @@ public abstract class PlayerList { } } - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.v1_6_R3.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.v1_7_R1.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause); event.useTravelAgent(useTravelAgent); Bukkit.getServer().getPluginManager().callEvent(event); @@ -590,7 +604,7 @@ public abstract class PlayerList { WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle(); WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle(); int i = worldserver.dimension; - + double y = enter.getY(); float yaw = enter.getYaw(); float pitch = enter.getPitch(); @@ -631,7 +645,7 @@ public abstract class PlayerList { worldserver1 = this.server.worlds.get(0); chunkcoordinates = worldserver1.getSpawn(); } else { - chunkcoordinates = worldserver1.getSpawn(); + chunkcoordinates = worldserver1.getDimensionSpawn(); } d0 = (double) chunkcoordinates.x; @@ -663,8 +677,9 @@ public abstract class PlayerList { worldserver.methodProfiler.b(); */ } - + // entity.spawnIn(worldserver1); + return new Location(worldserver1.getWorld(), d0, y, d1, yaw, pitch); } @@ -730,9 +745,7 @@ public abstract class PlayerList { 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); // worldserver1.s().a(entity, d3, d4, d5, f); if (portal) { Vector velocity = entity.getBukkitEntity().getVelocity(); @@ -742,6 +755,8 @@ public abstract class PlayerList { entity.getBukkitEntity().setVelocity(velocity); } } + worldserver1.addEntity(entity); + worldserver1.entityJoinedWorld(entity, false); } worldserver.methodProfiler.b(); @@ -752,15 +767,15 @@ public abstract class PlayerList { } public void tick() { - if (++this.n > 600) { - this.n = 0; + if (++this.p > 600) { + this.p = 0; } /* CraftBukkit start - Remove updating of lag to players -- it spams way to much on big servers. - if (this.n < this.players.size()) { - EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n); + if (this.p < this.players.size()) { + EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.p); - this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, entityplayer.ping)); + this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, entityplayer.ping)); } // CraftBukkit end */ } @@ -817,7 +832,7 @@ public abstract class PlayerList { this.operators.add(s.toLowerCase()); // CraftBukkit start - Player player = server.server.getPlayer(s); + Player player = server.server.getPlayerExact(s); if (player != null) { player.recalculatePermissions(); } @@ -828,7 +843,7 @@ public abstract class PlayerList { this.operators.remove(s.toLowerCase()); // CraftBukkit start - Player player = server.server.getPlayer(s); + Player player = server.server.getPlayerExact(s); if (player != null) { player.recalculatePermissions(); } @@ -841,8 +856,8 @@ public abstract class PlayerList { } public boolean isOp(String s) { - // CraftBukkit - return this.operators.contains(s.trim().toLowerCase()) || this.server.K() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.J().equalsIgnoreCase(s) || this.m; + // CraftBukkit - fix reference to worldserver array + return this.operators.contains(s.trim().toLowerCase()) || this.server.L() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.K().equalsIgnoreCase(s) || this.o; } public EntityPlayer getPlayer(String s) { @@ -884,7 +899,7 @@ public abstract class PlayerList { for (int i2 = 0; i2 < this.players.size(); ++i2) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(i2); - if ((world == null || entityplayer.world == world) && (s == null || flag1 != s.equalsIgnoreCase(entityplayer.getLocalizedName()))) { + if ((world == null || entityplayer.world == world) && (s == null || flag1 != s.equalsIgnoreCase(entityplayer.getName()))) { if (s1 != null) { ScoreboardTeamBase scoreboardteambase = entityplayer.getScoreboardTeam(); String s2 = scoreboardteambase == null ? "" : scoreboardteambase.getName(); @@ -895,7 +910,7 @@ public abstract class PlayerList { } if (chunkcoordinates != null && (i > 0 || j > 0)) { - float f = chunkcoordinates.e(entityplayer.b()); + float f = chunkcoordinates.e(entityplayer.getChunkCoordinates()); if (i > 0 && f < (float) k1 || j > 0 && f > (float) l1) { continue; @@ -953,7 +968,7 @@ public abstract class PlayerList { return false; } - ScoreboardScore scoreboardscore = entityhuman.getScoreboard().getPlayerScoreForObjective(entityhuman.getLocalizedName(), scoreboardobjective); + ScoreboardScore scoreboardscore = entityhuman.getScoreboard().getPlayerScoreForObjective(entityhuman.getName(), scoreboardobjective); i = scoreboardscore.getScore(); if (i < ((Integer) entry.getValue()).intValue() && flag) { @@ -980,6 +995,7 @@ public abstract class PlayerList { continue; } // CraftBukkit end + if (entityplayer != entityhuman && entityplayer.dimension == i) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; @@ -1017,16 +1033,21 @@ public abstract class PlayerList { public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { - entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); - if (worldserver.Q()) { - entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather + entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); + if (worldserver.P()) { + // CraftBukkit start - handle player weather + // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0.0F)); + // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.j(1.0F))); + // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.h(1.0F))); + entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); + // CraftBukkit end } } public void updateClient(EntityPlayer entityplayer) { entityplayer.updateInventory(entityplayer.defaultContainer); entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange - entityplayer.playerConnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex)); + entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); } public int getPlayerCount() { @@ -1038,7 +1059,8 @@ public abstract class PlayerList { } public String[] getSeenPlayers() { - return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); // CraftBukkit + // CraftBukkit - fix reference to worldserver array + return this.server.worlds.get(0).getDataManager().getPlayerFileData().getSeenPlayers(); } public boolean getHasWhitelist() { @@ -1049,14 +1071,14 @@ public abstract class PlayerList { this.hasWhitelist = flag; } - public List i(String s) { + public List h(String s) { ArrayList arraylist = new ArrayList(); Iterator iterator = this.players.iterator(); while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); - if (entityplayer.q().equals(s)) { + if (entityplayer.s().equals(s)) { arraylist.add(entityplayer); } } @@ -1079,25 +1101,45 @@ public abstract class PlayerList { private void a(EntityPlayer entityplayer, EntityPlayer entityplayer1, World world) { if (entityplayer1 != null) { entityplayer.playerInteractManager.setGameMode(entityplayer1.playerInteractManager.getGameMode()); - } else if (this.l != null) { - entityplayer.playerInteractManager.setGameMode(this.l); + } else if (this.n != null) { + entityplayer.playerInteractManager.setGameMode(this.n); } entityplayer.playerInteractManager.b(world.getWorldData().getGameType()); } public void r() { - while (!this.players.isEmpty()) { - ((EntityPlayer) this.players.get(0)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message + for (int i = 0; i < this.players.size(); ++i) { + ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message } } - public void sendMessage(ChatMessage chatmessage, boolean flag) { - this.server.sendMessage(chatmessage); - this.sendAll(new Packet3Chat(chatmessage, flag)); + // CraftBukkit start - Support multi-line messages + public void sendMessage(IChatBaseComponent[] ichatbasecomponent) { + for (IChatBaseComponent component : ichatbasecomponent) { + sendMessage(component, true); + } + } + // CraftBukkit end + + public void sendMessage(IChatBaseComponent ichatbasecomponent, boolean flag) { + this.server.sendMessage(ichatbasecomponent); + this.sendAll(new PacketPlayOutChat(ichatbasecomponent, flag)); } - public void sendMessage(ChatMessage chatmessage) { - this.sendMessage(chatmessage, true); + public void sendMessage(IChatBaseComponent ichatbasecomponent) { + this.sendMessage(ichatbasecomponent, true); } -} \ No newline at end of file + + public ServerStatisticManager i(String s) { + ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.k.get(s); + + if (serverstatisticmanager == null) { + serverstatisticmanager = new ServerStatisticManager(this.server, new File(this.server.getWorldServer(0).getDataManager().getDirectory(), "stats/" + s + ".json")); + serverstatisticmanager.a(); + this.k.put(s, serverstatisticmanager); + } + + return serverstatisticmanager; + } +} diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/QueuedPacket.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/QueuedPacket.java new file mode 100644 index 000000000..ae7f99398 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/QueuedPacket.java @@ -0,0 +1,25 @@ +package net.minecraft.server.v1_7_R1; + +import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener; + +public class QueuedPacket +{ + private final Packet a; + private final GenericFutureListener[] b; + + public QueuedPacket(Packet packet, GenericFutureListener... agenericfuturelistener) + { + this.a = packet; + this.b = agenericfuturelistener; + } + + public static Packet a(QueuedPacket queuedpacket) + { + return queuedpacket.a; + } + + public static GenericFutureListener[] b(QueuedPacket queuedpacket) + { + return queuedpacket.b; + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/World.java b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/World.java similarity index 73% rename from Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/World.java rename to Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/World.java index 4f2815539..936273b01 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_6_R3/World.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/net/minecraft/server/v1_7_R1/World.java @@ -1,4 +1,4 @@ -package net.minecraft.server.v1_6_R3; +package net.minecraft.server.v1_7_R1; import java.util.ArrayList; import java.util.Calendar; @@ -12,12 +12,13 @@ import java.util.concurrent.Callable; // CraftBukkit start import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_6_R3.util.LongHashSet; -import org.bukkit.craftbukkit.v1_6_R3.util.UnsafeList; +import org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers; +import org.bukkit.craftbukkit.v1_7_R1.util.LongHashSet; +import org.bukkit.craftbukkit.v1_7_R1.util.UnsafeList; import org.bukkit.generator.ChunkGenerator; -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.event.CraftEventFactory; +import org.bukkit.craftbukkit.v1_7_R1.CraftServer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory; import org.bukkit.event.block.BlockCanBuildEvent; import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; @@ -44,48 +45,54 @@ public abstract class World implements IBlockAccess { protected float o; protected float p; public int q; - public boolean callingPlaceEvent = false; // CraftBukkit - public int difficulty; + public EnumDifficulty difficulty; public Random random = new Random(); public WorldProvider worldProvider; // CraftBukkit - remove final protected List u = new ArrayList(); - public IChunkProvider chunkProvider; // CraftBukkit - protected -> public + public IChunkProvider chunkProvider; // CraftBukkit - public protected final IDataManager dataManager; - public WorldData worldData; // CraftBukkit - protected -> public + public WorldData worldData; // CraftBukkit - public public boolean isLoading; - public WorldMapCollection worldMaps; - public final VillageCollection villages; + public PersistentCollection worldMaps; + public final PersistentVillage villages; protected final VillageSiege siegeManager = new VillageSiege(this); public final MethodProfiler methodProfiler; private final Vec3DPool J = new Vec3DPool(300, 2000); private final Calendar K = Calendar.getInstance(); public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - protected -> public - private final IConsoleLogManager logAgent; - private UnsafeList M = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList - private boolean N; + public boolean isStatic; // CraftBukkit start - public, longhashset - public boolean allowMonsters = true; - public boolean allowAnimals = true; protected LongHashSet chunkTickList = new LongHashSet(); + private int L; + public boolean allowMonsters; + public boolean allowAnimals; + // Added the following + public boolean callingPlaceEvent = false; public long ticksPerAnimalSpawns; public long ticksPerMonsterSpawns; + public boolean populating; + private int tickPosition; // CraftBukkit end - private int O; - int[] H; - public boolean isStatic; + private ArrayList M; + private boolean N; + int[] I; - private Entity _startEntity; - public BiomeBase getBiome(int i, int j) { if (this.isLoaded(i, 0, j)) { Chunk chunk = this.getChunkAtWorldCoords(i, j); - if (chunk != null) { + try { return chunk.a(i & 15, j & 15, this.worldProvider.e); - } - } + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Getting biome"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Coordinates of biome request"); - return this.worldProvider.e.getBiome(i, j); + crashreportsystemdetails.a("Location", (Callable) (new CrashReportWorldLocation(this, i, j))); + throw new ReportedException(crashreport); + } + } else { + return this.worldProvider.e.getBiome(i, j); + } } public WorldChunkManager getWorldChunkManager() { @@ -101,6 +108,8 @@ public abstract class World implements IBlockAccess { int lastXAccessed = Integer.MIN_VALUE; int lastZAccessed = Integer.MIN_VALUE; final Object chunkLock = new Object(); + + private Entity _startEntity; public CraftWorld getWorld() { return this.world; @@ -110,20 +119,22 @@ public abstract class World implements IBlockAccess { return (CraftServer) Bukkit.getServer(); } - // Changed signature - public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) { + // Changed signature - added gen and env + public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) { this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit // CraftBukkit end - this.O = this.random.nextInt(12000); - this.H = new int['\u8000']; + this.L = this.random.nextInt(12000); + this.allowMonsters = true; + this.allowAnimals = true; + this.M = new ArrayList(); + this.I = new int['\u8000']; this.dataManager = idatamanager; this.methodProfiler = methodprofiler; - this.worldMaps = new WorldMapCollection(idatamanager); - this.logAgent = iconsolelogmanager; + this.worldMaps = new PersistentCollection(idatamanager); this.worldData = idatamanager.getWorldData(); if (worldprovider != null) { this.worldProvider = worldprovider; @@ -159,13 +170,13 @@ public abstract class World implements IBlockAccess { this.worldData.d(true); } - VillageCollection villagecollection = (VillageCollection) this.worldMaps.get(VillageCollection.class, "villages"); + PersistentVillage persistentvillage = (PersistentVillage) this.worldMaps.get(PersistentVillage.class, "villages"); - if (villagecollection == null) { - this.villages = new VillageCollection(this); + if (persistentvillage == null) { + this.villages = new PersistentVillage(this); this.worldMaps.a("villages", this.villages); } else { - this.villages = villagecollection; + this.villages = persistentvillage; this.villages.a(this); } @@ -181,56 +192,38 @@ public abstract class World implements IBlockAccess { this.worldData.d(true); } - public int b(int i, int j) { + public Block b(int i, int j) { int k; for (k = 63; !this.isEmpty(i, k + 1, j); ++k) { ; } - return this.getTypeId(i, k, j); + return this.getType(i, k, j); } - public int getTypeId(int i, int j, int k) { - if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) { - if (j < 0) { - return 0; - } else if (j >= 256) { - return 0; - } else { - Chunk chunk = null; + public Block getType(int i, int j, int k) { + if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j >= 0 && j < 256) { + Chunk chunk = null; - try { - chunk = this.getChunkAt(i >> 4, k >> 4); - return chunk.getTypeId(i & 15, j, k & 15); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates"); + try { + chunk = this.getChunkAt(i >> 4, k >> 4); + return chunk.getType(i & 15, j, k & 15); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Exception getting block type in world"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Requested block coordinates"); - crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null)); - crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k)); - throw new ReportedException(crashreport); - } + crashreportsystemdetails.a("Found chunk", Boolean.valueOf(chunk == null)); + crashreportsystemdetails.a("Location", CrashReportSystemDetails.a(i, j, k)); + throw new ReportedException(crashreport); } } else { - return 0; + return Blocks.AIR; } } public boolean isEmpty(int i, int j, int k) { - return this.getTypeId(i, j, k) == 0; - } - - public boolean isTileEntity(int i, int j, int k) { - int l = this.getTypeId(i, j, k); - - return Block.byId[l] != null && Block.byId[l].t(); - } - - public int e(int i, int j, int k) { - int l = this.getTypeId(i, j, k); - - return Block.byId[l] != null ? Block.byId[l].d() : -1; + return this.getType(i, j, k).getMaterial() == Material.AIR; } public boolean isLoaded(int i, int j, int k) { @@ -238,10 +231,10 @@ public abstract class World implements IBlockAccess { } public boolean areChunksLoaded(int i, int j, int k, int l) { - return this.e(i - l, j - l, k - l, i + l, j + l, k + l); + return this.b(i - l, j - l, k - l, i + l, j + l, k + l); } - public boolean e(int i, int j, int k, int l, int i1, int j1) { + public boolean b(int i, int j, int k, int l, int i1, int j1) { if (i1 >= 0 && j < 256) { i >>= 4; k >>= 4; @@ -271,8 +264,8 @@ public abstract class World implements IBlockAccess { return this.getChunkAt(i >> 4, j >> 4); } - // CraftBukkit start public Chunk getChunkAt(int i, int j) { + // CraftBukkit start Chunk result = null; synchronized (this.chunkLock) { if (this.lastChunkAccessed == null || this.lastXAccessed != i || this.lastZAccessed != j) { @@ -283,10 +276,10 @@ public abstract class World implements IBlockAccess { result = this.lastChunkAccessed; } return result; + // CraftBukkit end } - // CraftBukkit end - public boolean setTypeIdAndData(int i, int j, int k, int l, int i1, int j1) { + public boolean setTypeAndData(int i, int j, int k, Block block, int l, int i1) { if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) { if (j < 0) { return false; @@ -294,28 +287,26 @@ public abstract class World implements IBlockAccess { return false; } else { Chunk chunk = this.getChunkAt(i >> 4, k >> 4); - int k1 = 0; + Block block1 = null; - if ((j1 & 1) != 0) { - k1 = chunk.getTypeId(i & 15, j, k & 15); + if ((i1 & 1) != 0) { + block1 = chunk.getType(i & 15, j, k & 15); } - boolean flag = chunk.a(i & 15, j, k & 15, l, i1); + boolean flag = chunk.a(i & 15, j, k & 15, block, l); this.methodProfiler.a("checkLight"); - this.A(i, j, k); + this.t(i, j, k); this.methodProfiler.b(); if (flag) { - if ((j1 & 2) != 0 && (!this.isStatic || (j1 & 4) == 0)) { + if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0) && chunk.k()) { this.notify(i, j, k); } - if (!this.isStatic && (j1 & 1) != 0) { - this.update(i, j, k, k1); - Block block = Block.byId[l]; - - if (block != null && block.q_()) { - this.m(i, j, k, l); + if (!this.isStatic && (i1 & 1) != 0) { + this.update(i, j, k, block1); + if (block.M()) { + this.f(i, j, k, block); } } } @@ -327,12 +318,6 @@ public abstract class World implements IBlockAccess { } } - public Material getMaterial(int i, int j, int k) { - int l = this.getTypeId(i, j, k); - - return l == 0 ? Material.AIR : Block.byId[l].material; - } - public int getData(int i, int j, int k) { if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) { if (j < 0) { @@ -361,21 +346,19 @@ public abstract class World implements IBlockAccess { Chunk chunk = this.getChunkAt(i >> 4, k >> 4); int j1 = i & 15; int k1 = k & 15; - boolean flag = chunk.b(j1, j, k1, l); + boolean flag = chunk.a(j1, j, k1, l); if (flag) { - int l1 = chunk.getTypeId(j1, j, k1); + Block block = chunk.getType(j1, j, k1); - if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0)) { + if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0) && chunk.k()) { this.notify(i, j, k); } if (!this.isStatic && (i1 & 1) != 0) { - this.update(i, j, k, l1); - Block block = Block.byId[l1]; - - if (block != null && block.q_()) { - this.m(i, j, k, l1); + this.update(i, j, k, block); + if (block.M()) { + this.f(i, j, k, block); } } } @@ -388,28 +371,28 @@ public abstract class World implements IBlockAccess { } public boolean setAir(int i, int j, int k) { - return this.setTypeIdAndData(i, j, k, 0, 0, 3); + return this.setTypeAndData(i, j, k, Blocks.AIR, 0, 3); } public boolean setAir(int i, int j, int k, boolean flag) { - int l = this.getTypeId(i, j, k); + Block block = this.getType(i, j, k); - if (l > 0) { - int i1 = this.getData(i, j, k); + if (block.getMaterial() == Material.AIR) { + return false; + } else { + int l = this.getData(i, j, k); - this.triggerEffect(2001, i, j, k, l + (i1 << 12)); + this.triggerEffect(2001, i, j, k, Block.b(block) + (l << 12)); if (flag) { - Block.byId[l].c(this, i, j, k, i1, 0); + block.b(this, i, j, k, l, 0); } - return this.setTypeIdAndData(i, j, k, 0, 0, 3); - } else { - return false; + return this.setTypeAndData(i, j, k, Blocks.AIR, 0, 3); } } - public boolean setTypeIdUpdate(int i, int j, int k, int l) { - return this.setTypeIdAndData(i, j, k, l, 0, 3); + public boolean setTypeUpdate(int i, int j, int k, Block block) { + return this.setTypeAndData(i, j, k, block, 0, 3); } public void notify(int i, int j, int k) { @@ -418,11 +401,16 @@ public abstract class World implements IBlockAccess { } } - public void update(int i, int j, int k, int l) { - this.applyPhysics(i, j, k, l); + public void update(int i, int j, int k, Block block) { + // CraftBukkit start + if (this.populating) { + return; + } + // CraftBukkit end + this.applyPhysics(i, j, k, block); } - public void e(int i, int j, int k, int l) { + public void b(int i, int j, int k, int l) { int i1; if (k > l) { @@ -437,99 +425,96 @@ public abstract class World implements IBlockAccess { } } - this.g(i, k, j, i, l, j); + this.c(i, k, j, i, l, j); } - public void g(int i, int j, int k, int l, int i1, int j1) { + public void c(int i, int j, int k, int l, int i1, int j1) { for (int k1 = 0; k1 < this.u.size(); ++k1) { ((IWorldAccess) this.u.get(k1)).a(i, j, k, l, i1, j1); } } - public void applyPhysics(int i, int j, int k, int l) { - this.g(i - 1, j, k, l); - this.g(i + 1, j, k, l); - this.g(i, j - 1, k, l); - this.g(i, j + 1, k, l); - this.g(i, j, k - 1, l); - this.g(i, j, k + 1, l); + public void applyPhysics(int i, int j, int k, Block block) { + this.e(i - 1, j, k, block); + this.e(i + 1, j, k, block); + this.e(i, j - 1, k, block); + this.e(i, j + 1, k, block); + this.e(i, j, k - 1, block); + this.e(i, j, k + 1, block); } - public void c(int i, int j, int k, int l, int i1) { - if (i1 != 4) { - this.g(i - 1, j, k, l); + public void b(int i, int j, int k, Block block, int l) { + if (l != 4) { + this.e(i - 1, j, k, block); } - if (i1 != 5) { - this.g(i + 1, j, k, l); + if (l != 5) { + this.e(i + 1, j, k, block); } - if (i1 != 0) { - this.g(i, j - 1, k, l); + if (l != 0) { + this.e(i, j - 1, k, block); } - if (i1 != 1) { - this.g(i, j + 1, k, l); + if (l != 1) { + this.e(i, j + 1, k, block); } - if (i1 != 2) { - this.g(i, j, k - 1, l); + if (l != 2) { + this.e(i, j, k - 1, block); } - if (i1 != 3) { - this.g(i, j, k + 1, l); + if (l != 3) { + this.e(i, j, k + 1, block); } } - public void g(int i, int j, int k, int l) { + public void e(int i, int j, int k, Block block) { if (!this.isStatic) { - int i1 = this.getTypeId(i, j, k); - Block block = Block.byId[i1]; + Block block1 = this.getType(i, j, k); - if (block != null) { - try { - // CraftBukkit start - CraftWorld world = ((WorldServer) this).getWorld(); - if (world != null) { - BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), l); - this.getServer().getPluginManager().callEvent(event); + try { + // CraftBukkit start + CraftWorld world = ((WorldServer) this).getWorld(); + if (world != null) { + BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(i, j, k), CraftMagicNumbers.getId(block)); + this.getServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } + if (event.isCancelled()) { + return; } - // CraftBukkit end - - block.doPhysics(this, i, j, k, l); - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated"); - - int j1; - - try { - j1 = this.getData(i, j, k); - } catch (Throwable throwable1) { - j1 = -1; - } - - crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, l))); - CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, i1, j1); - throw new ReportedException(crashreport); } + // CraftBukkit end + + block1.doPhysics(this, i, j, k, block); + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being updated"); + + int l; + + try { + l = this.getData(i, j, k); + } catch (Throwable throwable1) { + l = -1; + } + + crashreportsystemdetails.a("Source block type", (Callable) (new CrashReportSourceBlockType(this, block))); + CrashReportSystemDetails.a(crashreportsystemdetails, i, j, k, block1, l); + throw new ReportedException(crashreport); } } } - public boolean a(int i, int j, int k, int l) { + public boolean a(int i, int j, int k, Block block) { return false; } - public boolean l(int i, int j, int k) { + public boolean i(int i, int j, int k) { return this.getChunkAt(i >> 4, k >> 4).d(i & 15, j, k & 15); } - public int m(int i, int j, int k) { + public int j(int i, int j, int k) { if (j < 0) { return 0; } else { @@ -537,7 +522,7 @@ public abstract class World implements IBlockAccess { j = 255; } - return this.getChunkAt(i >> 4, k >> 4).c(i & 15, j, k & 15, 0); + return this.getChunkAt(i >> 4, k >> 4).b(i & 15, j, k & 15, 0); } } @@ -547,37 +532,31 @@ public abstract class World implements IBlockAccess { public int b(int i, int j, int k, boolean flag) { if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) { - if (flag) { - int l = this.getTypeId(i, j, k); + if (flag && this.getType(i, j, k).n()) { + int l = this.b(i, j + 1, k, false); + int i1 = this.b(i + 1, j, k, false); + int j1 = this.b(i - 1, j, k, false); + int k1 = this.b(i, j, k + 1, false); + int l1 = this.b(i, j, k - 1, false); - if (Block.x[l]) { - int i1 = this.b(i, j + 1, k, false); - int j1 = this.b(i + 1, j, k, false); - int k1 = this.b(i - 1, j, k, false); - int l1 = this.b(i, j, k + 1, false); - int i2 = this.b(i, j, k - 1, false); - - if (j1 > i1) { - i1 = j1; - } - - if (k1 > i1) { - i1 = k1; - } - - if (l1 > i1) { - i1 = l1; - } - - if (i2 > i1) { - i1 = i2; - } - - return i1; + if (i1 > l) { + l = i1; } - } - if (j < 0) { + if (j1 > l) { + l = j1; + } + + if (k1 > l) { + l = k1; + } + + if (l1 > l) { + l = l1; + } + + return l; + } else if (j < 0) { return 0; } else { if (j >= 256) { @@ -588,7 +567,7 @@ public abstract class World implements IBlockAccess { i &= 15; k &= 15; - return chunk.c(i, j, k, this.j); + return chunk.b(i, j, k, this.j); } } else { return 15; @@ -605,7 +584,7 @@ public abstract class World implements IBlockAccess { return chunk.b(i & 15, j & 15); } } else { - return 0; + return 64; } } @@ -616,10 +595,10 @@ public abstract class World implements IBlockAccess { } else { Chunk chunk = this.getChunkAt(i >> 4, j >> 4); - return chunk.p; + return chunk.r; } } else { - return 0; + return 64; } } @@ -666,13 +645,13 @@ public abstract class World implements IBlockAccess { } } - public void p(int i, int j, int k) { + public void m(int i, int j, int k) { for (int l = 0; l < this.u.size(); ++l) { ((IWorldAccess) this.u.get(l)).b(i, j, k); } } - public float q(int i, int j, int k) { + public float n(int i, int j, int k) { return this.worldProvider.h[this.getLightLevel(i, j, k)]; } @@ -681,14 +660,14 @@ public abstract class World implements IBlockAccess { } public MovingObjectPosition a(Vec3D vec3d, Vec3D vec3d1) { - return this.rayTrace(vec3d, vec3d1, false, false); + return this.rayTrace(vec3d, vec3d1, false, false, false); } public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag) { - return this.rayTrace(vec3d, vec3d1, flag, false); + return this.rayTrace(vec3d, vec3d1, flag, false, false); } - public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag, boolean flag1) { + public MovingObjectPosition rayTrace(Vec3D vec3d, Vec3D vec3d1, boolean flag, boolean flag1, boolean flag2) { if (!Double.isNaN(vec3d.c) && !Double.isNaN(vec3d.d) && !Double.isNaN(vec3d.e)) { if (!Double.isNaN(vec3d1.c) && !Double.isNaN(vec3d1.d) && !Double.isNaN(vec3d1.e)) { int i = MathHelper.floor(vec3d1.c); @@ -697,11 +676,10 @@ public abstract class World implements IBlockAccess { int l = MathHelper.floor(vec3d.c); int i1 = MathHelper.floor(vec3d.d); int j1 = MathHelper.floor(vec3d.e); - int k1 = this.getTypeId(l, i1, j1); - int l1 = this.getData(l, i1, j1); - Block block = Block.byId[k1]; + Block block = this.getType(l, i1, j1); + int k1 = this.getData(l, i1, j1); - if ((!flag1 || block == null || block.b(this, l, i1, j1) != null) && k1 > 0 && block.a(l1, flag)) { + if ((!flag1 || block.a(this, l, i1, j1) != null) && block.a(k1, flag)) { MovingObjectPosition movingobjectposition = block.a(this, l, i1, j1, vec3d, vec3d1); if (movingobjectposition != null) { @@ -709,6 +687,8 @@ public abstract class World implements IBlockAccess { } } + MovingObjectPosition movingobjectposition1 = null; + k1 = 200; while (k1-- >= 0) { @@ -717,12 +697,12 @@ public abstract class World implements IBlockAccess { } if (l == i && i1 == j && j1 == k) { - return null; + return flag2 ? movingobjectposition1 : null; } - boolean flag2 = true; boolean flag3 = true; boolean flag4 = true; + boolean flag5 = true; double d0 = 999.0D; double d1 = 999.0D; double d2 = 999.0D; @@ -732,7 +712,7 @@ public abstract class World implements IBlockAccess { } else if (i < l) { d0 = (double) l + 0.0D; } else { - flag2 = false; + flag3 = false; } if (j > i1) { @@ -740,7 +720,7 @@ public abstract class World implements IBlockAccess { } else if (j < i1) { d1 = (double) i1 + 0.0D; } else { - flag3 = false; + flag4 = false; } if (k > j1) { @@ -748,7 +728,7 @@ public abstract class World implements IBlockAccess { } else if (k < j1) { d2 = (double) j1 + 0.0D; } else { - flag4 = false; + flag5 = false; } double d3 = 999.0D; @@ -758,19 +738,19 @@ public abstract class World implements IBlockAccess { double d7 = vec3d1.d - vec3d.d; double d8 = vec3d1.e - vec3d.e; - if (flag2) { + if (flag3) { d3 = (d0 - vec3d.c) / d6; } - if (flag3) { + if (flag4) { d4 = (d1 - vec3d.d) / d7; } - if (flag4) { + if (flag5) { d5 = (d2 - vec3d.e) / d8; } - boolean flag5 = false; + boolean flag6 = false; byte b0; if (d3 < d4 && d3 < d5) { @@ -825,22 +805,25 @@ public abstract class World implements IBlockAccess { ++vec3d2.e; } - int i2 = this.getTypeId(l, i1, j1); - int j2 = this.getData(l, i1, j1); - Block block1 = Block.byId[i2]; + Block block1 = this.getType(l, i1, j1); + int l1 = this.getData(l, i1, j1); - if ((!flag1 || block1 == null || block1.b(this, l, i1, j1) != null) && i2 > 0 && block1.a(j2, flag)) { - MovingObjectPosition movingobjectposition1 = block1.a(this, l, i1, j1, vec3d, vec3d1); + if (!flag1 || block1.a(this, l, i1, j1) != null) { + if (block1.a(l1, flag)) { + MovingObjectPosition movingobjectposition2 = block1.a(this, l, i1, j1, vec3d, vec3d1); - if (movingobjectposition1 != null) { - vec3d2.b.release(vec3d2); // CraftBukkit - return movingobjectposition1; + if (movingobjectposition2 != null) { + vec3d2.b.release(vec3d2); // CraftBukkit + return movingobjectposition2; + } + } else { + movingobjectposition1 = new MovingObjectPosition(l, i1, j1, b0, vec3d, false); } } vec3d2.b.release(vec3d2); // CraftBukkit } - return null; + return flag2 ? movingobjectposition1 : null; } else { return null; } @@ -850,26 +833,20 @@ public abstract class World implements IBlockAccess { } public void makeSound(Entity entity, String s, float f, float f1) { - if (entity != null && s != null) { - for (int i = 0; i < this.u.size(); ++i) { - ((IWorldAccess) this.u.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1); - } + for (int i = 0; i < this.u.size(); ++i) { + ((IWorldAccess) this.u.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1); } } public void a(EntityHuman entityhuman, String s, float f, float f1) { - if (entityhuman != null && s != null) { - for (int i = 0; i < this.u.size(); ++i) { - ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1); - } + for (int i = 0; i < this.u.size(); ++i) { + ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1); } } public void makeSound(double d0, double d1, double d2, String s, float f, float f1) { - if (s != null) { - for (int i = 0; i < this.u.size(); ++i) { - ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1); - } + for (int i = 0; i < this.u.size(); ++i) { + ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1); } } @@ -892,8 +869,8 @@ public abstract class World implements IBlockAccess { return true; } - // CraftBukkit start - Used for entities other than creatures public boolean addEntity(Entity entity) { + // CraftBukkit start - Used for entities other than creatures return this.addEntity(entity, SpawnReason.DEFAULT); // Set reason as DEFAULT } @@ -903,7 +880,7 @@ public abstract class World implements IBlockAccess { int i = MathHelper.floor(entity.locX / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D); - boolean flag = entity.p; + boolean flag = entity.o; if (entity instanceof EntityHuman) { flag = true; @@ -993,14 +970,23 @@ public abstract class World implements IBlockAccess { this.everyoneSleeping(); } - int i = entity.aj; - int j = entity.al; + int i = entity.ai; + int j = entity.ak; - if (entity.ai && this.isChunkLoaded(i, j)) { + if (entity.ah && this.isChunkLoaded(i, j)) { this.getChunkAt(i, j).b(entity); } - this.entityList.remove(entity); + // CraftBukkit start - Decrement loop variable field if we've already ticked this entity + int index = this.entityList.indexOf(entity); + if (index != -1) { + if (index <= this.tickPosition) { + this.tickPosition--; + } + this.entityList.remove(index); + } + // CraftBukkit end + this.b(entity); } @@ -1021,11 +1007,15 @@ public abstract class World implements IBlockAccess { for (int l1 = i1; l1 < j1; ++l1) { if (this.isLoaded(k1, 64, l1)) { for (int i2 = k - 1; i2 < l; ++i2) { - Block block = Block.byId[this.getTypeId(k1, i2, l1)]; + Block block; - if (block != null) { - block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); + if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) { + block = this.getType(k1, i2, l1); + } else { + block = Blocks.STONE; } + + block.a(this, k1, i2, l1, axisalignedbb, this.M, entity); } } } @@ -1035,7 +1025,7 @@ public abstract class World implements IBlockAccess { List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0)); for (int j2 = 0; j2 < list.size(); ++j2) { - AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).E(); + AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).J(); if (axisalignedbb1 != null && axisalignedbb1.b(axisalignedbb)) { this.M.add(axisalignedbb1); @@ -1063,11 +1053,15 @@ public abstract class World implements IBlockAccess { for (int l1 = i1; l1 < j1; ++l1) { if (this.isLoaded(k1, 64, l1)) { for (int i2 = k - 1; i2 < l; ++i2) { - Block block = Block.byId[this.getTypeId(k1, i2, l1)]; + Block block; - if (block != null) { - block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null); + if (k1 >= -30000000 && k1 < 30000000 && l1 >= -30000000 && l1 < 30000000) { + block = this.getType(k1, i2, l1); + } else { + block = Blocks.BEDROCK; } + + block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null); } } } @@ -1089,7 +1083,7 @@ public abstract class World implements IBlockAccess { } f2 = 1.0F - f2; - f2 = (float) ((double) f2 * (1.0D - (double) (this.i(f) * 5.0F) / 16.0D)); + f2 = (float) ((double) f2 * (1.0D - (double) (this.j(f) * 5.0F) / 16.0D)); f2 = (float) ((double) f2 * (1.0D - (double) (this.h(f) * 5.0F) / 16.0D)); f2 = 1.0F - f2; return (int) (f2 * 11.0F); @@ -1120,9 +1114,9 @@ public abstract class World implements IBlockAccess { i &= 15; for (j &= 15; k > 0; --k) { - int l = chunk.getTypeId(i, k, j); + Block block = chunk.getType(i, k, j); - if (l != 0 && Block.byId[l].material.isSolid() && Block.byId[l].material != Material.LEAVES) { + if (block.getMaterial().isSolid() && block.getMaterial() != Material.LEAVES) { return k + 1; } } @@ -1130,11 +1124,11 @@ public abstract class World implements IBlockAccess { return -1; } - public void a(int i, int j, int k, int l, int i1) {} + public void a(int i, int j, int k, Block block, int l) {} - public void a(int i, int j, int k, int l, int i1, int j1) {} + public void a(int i, int j, int k, Block block, int l, int i1) {} - public void b(int i, int j, int k, int l, int i1, int j1) {} + public void b(int i, int j, int k, Block block, int l, int i1) {} public void tickEntities() { this.methodProfiler.a("entities"); @@ -1160,7 +1154,7 @@ public abstract class World implements IBlockAccess { try { ++entity.ticksLived; - entity.l_(); + entity.h(); } catch (Throwable throwable) { crashreport = CrashReport.a(throwable, "Ticking entity"); crashreportsystemdetails = crashreport.a("Entity being ticked"); @@ -1186,9 +1180,9 @@ public abstract class World implements IBlockAccess { for (i = 0; i < this.f.size(); ++i) { entity = (Entity) this.f.get(i); - j = entity.aj; - k = entity.al; - if (entity.ai && this.isChunkLoaded(j, k)) { + j = entity.ai; + k = entity.ak; + if (entity.ah && this.isChunkLoaded(j, k)) { this.getChunkAt(j, k).b(entity); } } @@ -1200,10 +1194,12 @@ public abstract class World implements IBlockAccess { this.f.clear(); this.methodProfiler.c("regular"); - for (i = 0; i < this.entityList.size(); ++i) { - entity = (Entity) this.entityList.get(i); + // CraftBukkit start - Use field for loop variable + for (this.tickPosition = 0; this.tickPosition < this.entityList.size(); ++this.tickPosition) { + entity = (Entity) this.entityList.get(this.tickPosition); - // CraftBukkit start - Don't tick entities in chunks queued for unload + + // Don't tick entities in chunks queued for unload ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer; if (chunkProviderServer.unloadQueue.contains(MathHelper.floor(entity.locX) >> 4, MathHelper.floor(entity.locZ) >> 4)) { continue; @@ -1234,20 +1230,20 @@ public abstract class World implements IBlockAccess { this.methodProfiler.b(); this.methodProfiler.a("remove"); if (entity.dead) { - j = entity.aj; - k = entity.al; - if (entity.ai && this.isChunkLoaded(j, k)) { + j = entity.ai; + k = entity.ak; + if (entity.ah && this.isChunkLoaded(j, k)) { this.getChunkAt(j, k).b(entity); } - this.entityList.remove(i--); + this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable this.b(entity); } this.methodProfiler.b(); } - this.methodProfiler.c("tileEntities"); + this.methodProfiler.c("blockEntities"); this.N = true; Iterator iterator = this.tileEntityList.iterator(); @@ -1264,8 +1260,8 @@ public abstract class World implements IBlockAccess { try { tileentity.h(); } catch (Throwable throwable2) { - crashreport = CrashReport.a(throwable2, "Ticking tile entity"); - crashreportsystemdetails = crashreport.a("Tile entity being ticked"); + crashreport = CrashReport.a(throwable2, "Ticking block entity"); + crashreportsystemdetails = crashreport.a("Block entity being ticked"); tileentity.a(crashreportsystemdetails); throw new ReportedException(crashreport); } @@ -1289,7 +1285,7 @@ public abstract class World implements IBlockAccess { this.b.clear(); } - this.methodProfiler.c("pendingTileEntities"); + this.methodProfiler.c("pendingBlockEntities"); if (!this.a.isEmpty()) { for (int l = 0; l < this.a.size(); ++l) { TileEntity tileentity1 = (TileEntity) this.a.get(l); @@ -1342,32 +1338,32 @@ public abstract class World implements IBlockAccess { int j = MathHelper.floor(entity.locZ); byte b0 = 32; - if (!flag || this.e(i - b0, 0, j - b0, i + b0, 0, j + b0)) { - entity.U = entity.locX; - entity.V = entity.locY; - entity.W = entity.locZ; + if (!flag || this.b(i - b0, 0, j - b0, i + b0, 0, j + b0)) { + entity.T = entity.locX; + entity.U = entity.locY; + entity.V = entity.locZ; entity.lastYaw = entity.yaw; entity.lastPitch = entity.pitch; - if (flag && entity.ai) { + if (flag && entity.ah) { ++entity.ticksLived; if (entity.vehicle != null) { - entity.V(); + entity.ab(); } else { - entity.l_(); + entity.h(); } } this.methodProfiler.a("chunkCheck"); if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) { - entity.locX = entity.U; + entity.locX = entity.T; } if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) { - entity.locY = entity.V; + entity.locY = entity.U; } if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) { - entity.locZ = entity.W; + entity.locZ = entity.V; } if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) { @@ -1382,31 +1378,31 @@ public abstract class World implements IBlockAccess { int l = MathHelper.floor(entity.locY / 16.0D); int i1 = MathHelper.floor(entity.locZ / 16.0D); - if (!entity.ai || entity.aj != k || entity.ak != l || entity.al != i1) { - if (entity.ai && this.isChunkLoaded(entity.aj, entity.al)) { - this.getChunkAt(entity.aj, entity.al).a(entity, entity.ak); + if (!entity.ah || entity.ai != k || entity.aj != l || entity.ak != i1) { + if (entity.ah && this.isChunkLoaded(entity.ai, entity.ak)) { + this.getChunkAt(entity.ai, entity.ak).a(entity, entity.aj); } if (this.isChunkLoaded(k, i1)) { - entity.ai = true; + entity.ah = true; this.getChunkAt(k, i1).a(entity); } else { - entity.ai = false; + entity.ah = false; } } this.methodProfiler.b(); - if (flag && entity.ai && entity.passenger != null) { - if (!entity.passenger.dead && entity.passenger.vehicle == entity && entity != _startEntity) { - if (_startEntity == null) - _startEntity = entity; - + if (flag && entity.ah && entity.passenger != null) + { + if (!entity.passenger.dead && entity.passenger.vehicle == entity) { + if (_startEntity == null) + _startEntity = entity; + + this.playerJoinedWorld(entity.passenger); } else if (entity == _startEntity) { - System.out.println("STUPIDFATBUGTARD"); - for (StackTraceElement element : Thread.currentThread().getStackTrace()) { System.out.println(element); @@ -1414,7 +1410,8 @@ public abstract class World implements IBlockAccess { entity.passenger.vehicle = null; entity.passenger = null; - _startEntity = null; + _startEntity = null; + } else { @@ -1440,7 +1437,7 @@ public abstract class World implements IBlockAccess { for (int i = 0; i < list.size(); ++i) { Entity entity1 = (Entity) list.get(i); - if (!entity1.dead && entity1.m && entity1 != entity) { + if (!entity1.dead && entity1.l && entity1 != entity) { return false; } } @@ -1471,9 +1468,9 @@ public abstract class World implements IBlockAccess { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { - Block block = Block.byId[this.getTypeId(k1, l1, i2)]; + Block block = this.getType(k1, l1, i2); - if (block != null) { + if (block.getMaterial() != Material.AIR) { return true; } } @@ -1506,9 +1503,9 @@ public abstract class World implements IBlockAccess { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { - Block block = Block.byId[this.getTypeId(k1, l1, i2)]; + Block block = this.getType(k1, l1, i2); - if (block != null && block.material.isLiquid()) { + if (block.getMaterial().isLiquid()) { return true; } } @@ -1526,13 +1523,13 @@ public abstract class World implements IBlockAccess { int i1 = MathHelper.floor(axisalignedbb.c); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); - if (this.e(i, k, i1, j, l, j1)) { + if (this.b(i, k, i1, j, l, j1)) { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { - int j2 = this.getTypeId(k1, l1, i2); + Block block = this.getType(k1, l1, i2); - if (j2 == Block.FIRE.id || j2 == Block.LAVA.id || j2 == Block.STATIONARY_LAVA.id) { + if (block == Blocks.FIRE || block == Blocks.LAVA || block == Blocks.STATIONARY_LAVA) { return true; } } @@ -1551,7 +1548,7 @@ public abstract class World implements IBlockAccess { int i1 = MathHelper.floor(axisalignedbb.c); int j1 = MathHelper.floor(axisalignedbb.f + 1.0D); - if (!this.e(i, k, i1, j, l, j1)) { + if (!this.b(i, k, i1, j, l, j1)) { return false; } else { boolean flag = false; @@ -1560,10 +1557,10 @@ public abstract class World implements IBlockAccess { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { - Block block = Block.byId[this.getTypeId(k1, l1, i2)]; + Block block = this.getType(k1, l1, i2); - if (block != null && block.material == material) { - double d0 = (double) ((float) (l1 + 1) - BlockFluids.d(this.getData(k1, l1, i2))); + if (block.getMaterial() == material) { + double d0 = (double) ((float) (l1 + 1) - BlockFluids.b(this.getData(k1, l1, i2))); if ((double) l >= d0) { flag = true; @@ -1574,7 +1571,7 @@ public abstract class World implements IBlockAccess { } } - if (vec3d.b() > 0.0D && entity.ax()) { + if (vec3d.b() > 0.0D && entity.aC()) { vec3d = vec3d.a(); double d1 = 0.014D; @@ -1599,9 +1596,7 @@ public abstract class World implements IBlockAccess { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { - Block block = Block.byId[this.getTypeId(k1, l1, i2)]; - - if (block != null && block.material == material) { + if (this.getType(k1, l1, i2).getMaterial() == material) { return true; } } @@ -1622,9 +1617,9 @@ public abstract class World implements IBlockAccess { for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { - Block block = Block.byId[this.getTypeId(k1, l1, i2)]; + Block block = this.getType(k1, l1, i2); - if (block != null && block.material == material) { + if (block.getMaterial() == material) { int j2 = this.getData(k1, l1, i2); double d0 = (double) (l1 + 1); @@ -1710,7 +1705,7 @@ public abstract class World implements IBlockAccess { ++i; } - if (this.getTypeId(i, j, k) == Block.FIRE.id) { + if (this.getType(i, j, k) == Blocks.FIRE) { this.a(entityhuman, 1004, i, j, k, 0); this.setAir(i, j, k); return true; @@ -1771,7 +1766,7 @@ public abstract class World implements IBlockAccess { TileEntity tileentity1 = (TileEntity) iterator.next(); if (tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) { - tileentity1.w_(); + tileentity1.s(); iterator.remove(); } } @@ -1788,11 +1783,11 @@ public abstract class World implements IBlockAccess { } } - public void s(int i, int j, int k) { + public void p(int i, int j, int k) { TileEntity tileentity = this.getTileEntity(i, j, k); if (tileentity != null && this.N) { - tileentity.w_(); + tileentity.s(); this.a.remove(tileentity); } else { if (tileentity != null) { @@ -1812,36 +1807,17 @@ public abstract class World implements IBlockAccess { this.b.add(tileentity); } - public boolean t(int i, int j, int k) { - Block block = Block.byId[this.getTypeId(i, j, k)]; + public boolean q(int i, int j, int k) { + AxisAlignedBB axisalignedbb = this.getType(i, j, k).a(this, i, j, k); - return block == null ? false : block.c(); + return axisalignedbb != null && axisalignedbb.b() >= 1.0D; } - public boolean u(int i, int j, int k) { - return Block.l(this.getTypeId(i, j, k)); - } + public static boolean a(IBlockAccess iblockaccess, int i, int j, int k) { + Block block = iblockaccess.getType(i, j, k); + int l = iblockaccess.getData(i, j, k); - public boolean v(int i, int j, int k) { - int l = this.getTypeId(i, j, k); - - if (l != 0 && Block.byId[l] != null) { - AxisAlignedBB axisalignedbb = Block.byId[l].b(this, i, j, k); - - return axisalignedbb != null && axisalignedbb.b() >= 1.0D; - } else { - return false; - } - } - - public boolean w(int i, int j, int k) { - Block block = Block.byId[this.getTypeId(i, j, k)]; - - return this.a(block, this.getData(i, j, k)); - } - - public boolean a(Block block, int i) { - return block == null ? false : (block.material.k() && block.b() ? true : (block instanceof BlockStairs ? (i & 4) == 4 : (block instanceof BlockStepAbstract ? (i & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (i & 7) == 7 : false))))); + return block.getMaterial().k() && block.d() ? true : (block instanceof BlockStairs ? (l & 4) == 4 : (block instanceof BlockStepAbstract ? (l & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (l & 7) == 7 : false)))); } public boolean c(int i, int j, int k, boolean flag) { @@ -1849,9 +1825,9 @@ public abstract class World implements IBlockAccess { Chunk chunk = this.chunkProvider.getOrCreateChunk(i >> 4, k >> 4); if (chunk != null && !chunk.isEmpty()) { - Block block = Block.byId[this.getTypeId(i, j, k)]; + Block block = this.getType(i, j, k); - return block == null ? false : block.material.k() && block.b(); + return block.getMaterial().k() && block.d(); } else { return flag; } @@ -1888,88 +1864,73 @@ public abstract class World implements IBlockAccess { protected void o() { if (!this.worldProvider.g) { - int i = this.worldData.getThunderDuration(); + if (!this.isStatic) { + int i = this.worldData.getThunderDuration(); - if (i <= 0) { - if (this.worldData.isThundering()) { - this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600); - } else { - this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000); - } - } else { - --i; - this.worldData.setThunderDuration(i); if (i <= 0) { - // CraftBukkit start - ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering()); - this.getServer().getPluginManager().callEvent(thunder); - if (!thunder.isCancelled()) { - this.worldData.setThundering(!this.worldData.isThundering()); + if (this.worldData.isThundering()) { + this.worldData.setThunderDuration(this.random.nextInt(12000) + 3600); + } else { + this.worldData.setThunderDuration(this.random.nextInt(168000) + 12000); } - // CraftBukkit end - } - } - - int j = this.worldData.getWeatherDuration(); - - if (j <= 0) { - if (this.worldData.hasStorm()) { - this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000); } else { - this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000); - } - } else { - --j; - this.worldData.setWeatherDuration(j); - if (j <= 0) { - // CraftBukkit start - WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm()); - this.getServer().getPluginManager().callEvent(weather); - - if (!weather.isCancelled()) { - this.worldData.setStorm(!this.worldData.hasStorm()); + --i; + this.worldData.setThunderDuration(i); + if (i <= 0) { + // CraftBukkit start + ThunderChangeEvent thunder = new ThunderChangeEvent(this.getWorld(), !this.worldData.isThundering()); + this.getServer().getPluginManager().callEvent(thunder); + if (!thunder.isCancelled()) { + this.worldData.setThundering(!this.worldData.isThundering()); + } + // CraftBukkit end } - // CraftBukkit end } - } - this.m = this.n; - if (this.worldData.hasStorm()) { - this.n = (float) ((double) this.n + 0.01D); - } else { - this.n = (float) ((double) this.n - 0.01D); - } + this.o = this.p; + if (this.worldData.isThundering()) { + this.p = (float) ((double) this.p + 0.01D); + } else { + this.p = (float) ((double) this.p - 0.01D); + } - if (this.n < 0.0F) { - this.n = 0.0F; - } + this.p = MathHelper.a(this.p, 0.0F, 1.0F); + int j = this.worldData.getWeatherDuration(); - if (this.n > 1.0F) { - this.n = 1.0F; - } + if (j <= 0) { + if (this.worldData.hasStorm()) { + this.worldData.setWeatherDuration(this.random.nextInt(12000) + 12000); + } else { + this.worldData.setWeatherDuration(this.random.nextInt(168000) + 12000); + } + } else { + --j; + this.worldData.setWeatherDuration(j); + if (j <= 0) { + // CraftBukkit start + WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), !this.worldData.hasStorm()); + this.getServer().getPluginManager().callEvent(weather); - this.o = this.p; - if (this.worldData.isThundering()) { - this.p = (float) ((double) this.p + 0.01D); - } else { - this.p = (float) ((double) this.p - 0.01D); - } + if (!weather.isCancelled()) { + this.worldData.setStorm(!this.worldData.hasStorm()); + } + // CraftBukkit end + } + } - if (this.p < 0.0F) { - this.p = 0.0F; - } + this.m = this.n; + if (this.worldData.hasStorm()) { + this.n = (float) ((double) this.n + 0.01D); + } else { + this.n = (float) ((double) this.n - 0.01D); + } - if (this.p > 1.0F) { - this.p = 1.0F; + this.n = MathHelper.a(this.n, 0.0F, 1.0F); } } } - public void B() { - this.worldData.setWeatherDuration(1); - } - - protected void C() { + protected void B() { // this.chunkTickList.clear(); // CraftBukkit - removed this.methodProfiler.a("buildList"); @@ -1993,14 +1954,14 @@ public abstract class World implements IBlockAccess { } // CraftBukkit end - this.chunkTickList.add(org.bukkit.craftbukkit.v1_6_R3.util.LongHash.toLong(l + j, i1 + k)); // CraftBukkit + this.chunkTickList.add(org.bukkit.craftbukkit.v1_7_R1.util.LongHash.toLong(l + j, i1 + k)); // CraftBukkit } } } this.methodProfiler.b(); - if (this.O > 0) { - --this.O; + if (this.L > 0) { + --this.L; } this.methodProfiler.a("playerCheckLight"); @@ -2011,7 +1972,7 @@ public abstract class World implements IBlockAccess { k = MathHelper.floor(entityhuman.locY) + this.random.nextInt(11) - 5; int j1 = MathHelper.floor(entityhuman.locZ) + this.random.nextInt(11) - 5; - this.A(j, k, j1); + this.t(j, k, j1); } this.methodProfiler.b(); @@ -2019,22 +1980,22 @@ public abstract class World implements IBlockAccess { protected void a(int i, int j, Chunk chunk) { this.methodProfiler.c("moodSound"); - if (this.O == 0 && !this.isStatic) { + if (this.L == 0 && !this.isStatic) { this.k = this.k * 3 + 1013904223; int k = this.k >> 2; int l = k & 15; int i1 = k >> 8 & 15; - int j1 = k >> 16 & 255; // CraftBukkit - 127 -> 255 - int k1 = chunk.getTypeId(l, j1, i1); + int j1 = k >> 16 & 255; + Block block = chunk.getType(l, j1, i1); l += i; i1 += j; - if (k1 == 0 && this.m(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) { + if (block.getMaterial() == Material.AIR && this.j(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) { EntityHuman entityhuman = this.findNearbyPlayer((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, 8.0D); if (entityhuman != null && entityhuman.e((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D) > 4.0D) { this.makeSound((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F); - this.O = this.random.nextInt(12000) + 6000; + this.L = this.random.nextInt(12000) + 6000; } } } @@ -2044,47 +2005,47 @@ public abstract class World implements IBlockAccess { } protected void g() { - this.C(); + this.B(); } - public boolean x(int i, int j, int k) { + public boolean r(int i, int j, int k) { return this.d(i, j, k, false); } - public boolean y(int i, int j, int k) { + public boolean s(int i, int j, int k) { return this.d(i, j, k, true); } public boolean d(int i, int j, int k, boolean flag) { BiomeBase biomebase = this.getBiome(i, k); - float f = biomebase.j(); + float f = biomebase.a(i, j, k); if (f > 0.15F) { return false; } else { if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) { - int l = this.getTypeId(i, j, k); + Block block = this.getType(i, j, k); - if ((l == Block.STATIONARY_WATER.id || l == Block.WATER.id) && this.getData(i, j, k) == 0) { + if ((block == Blocks.STATIONARY_WATER || block == Blocks.WATER) && this.getData(i, j, k) == 0) { if (!flag) { return true; } boolean flag1 = true; - if (flag1 && this.getMaterial(i - 1, j, k) != Material.WATER) { + if (flag1 && this.getType(i - 1, j, k).getMaterial() != Material.WATER) { flag1 = false; } - if (flag1 && this.getMaterial(i + 1, j, k) != Material.WATER) { + if (flag1 && this.getType(i + 1, j, k).getMaterial() != Material.WATER) { flag1 = false; } - if (flag1 && this.getMaterial(i, j, k - 1) != Material.WATER) { + if (flag1 && this.getType(i, j, k - 1).getMaterial() != Material.WATER) { flag1 = false; } - if (flag1 && this.getMaterial(i, j, k + 1) != Material.WATER) { + if (flag1 && this.getType(i, j, k + 1).getMaterial() != Material.WATER) { flag1 = false; } @@ -2098,18 +2059,19 @@ public abstract class World implements IBlockAccess { } } - public boolean z(int i, int j, int k) { + public boolean e(int i, int j, int k, boolean flag) { BiomeBase biomebase = this.getBiome(i, k); - float f = biomebase.j(); + float f = biomebase.a(i, j, k); if (f > 0.15F) { return false; + } else if (!flag) { + return true; } else { if (j >= 0 && j < 256 && this.b(EnumSkyBlock.BLOCK, i, j, k) < 10) { - int l = this.getTypeId(i, j - 1, k); - int i1 = this.getTypeId(i, j, k); + Block block = this.getType(i, j, k); - if (i1 == 0 && Block.SNOW.canPlace(this, i, j, k) && l != 0 && l != Block.ICE.id && Block.byId[l].material.isSolid()) { + if (block.getMaterial() == Material.AIR && Blocks.SNOW.canPlace(this, i, j, k)) { return true; } } @@ -2118,57 +2080,62 @@ public abstract class World implements IBlockAccess { } } - public void A(int i, int j, int k) { + public boolean t(int i, int j, int k) { + boolean flag = false; + if (!this.worldProvider.g) { - this.c(EnumSkyBlock.SKY, i, j, k); + flag |= this.c(EnumSkyBlock.SKY, i, j, k); } - this.c(EnumSkyBlock.BLOCK, i, j, k); + flag |= this.c(EnumSkyBlock.BLOCK, i, j, k); + return flag; } private int a(int i, int j, int k, EnumSkyBlock enumskyblock) { - if (enumskyblock == EnumSkyBlock.SKY && this.l(i, j, k)) { + if (enumskyblock == EnumSkyBlock.SKY && this.i(i, j, k)) { return 15; } else { - int l = this.getTypeId(i, j, k); - int i1 = enumskyblock == EnumSkyBlock.SKY ? 0 : Block.lightEmission[l]; - int j1 = Block.lightBlock[l]; + Block block = this.getType(i, j, k); + int l = enumskyblock == EnumSkyBlock.SKY ? 0 : block.m(); + int i1 = block.k(); - if (j1 >= 15 && Block.lightEmission[l] > 0) { - j1 = 1; + if (i1 >= 15 && block.m() > 0) { + i1 = 1; } - if (j1 < 1) { - j1 = 1; + if (i1 < 1) { + i1 = 1; } - if (j1 >= 15) { + if (i1 >= 15) { return 0; - } else if (i1 >= 14) { - return i1; + } else if (l >= 14) { + return l; } else { - for (int k1 = 0; k1 < 6; ++k1) { - int l1 = i + Facing.b[k1]; - int i2 = j + Facing.c[k1]; - int j2 = k + Facing.d[k1]; - int k2 = this.b(enumskyblock, l1, i2, j2) - j1; + for (int j1 = 0; j1 < 6; ++j1) { + int k1 = i + Facing.b[j1]; + int l1 = j + Facing.c[j1]; + int i2 = k + Facing.d[j1]; + int j2 = this.b(enumskyblock, k1, l1, i2) - i1; - if (k2 > i1) { - i1 = k2; + if (j2 > l) { + l = j2; } - if (i1 >= 14) { - return i1; + if (l >= 14) { + return l; } } - return i1; + return l; } } } - public void c(EnumSkyBlock enumskyblock, int i, int j, int k) { - if (this.areChunksLoaded(i, j, k, 17)) { + public boolean c(EnumSkyBlock enumskyblock, int i, int j, int k) { + if (!this.areChunksLoaded(i, j, k, 17)) { + return false; + } else { int l = 0; int i1 = 0; @@ -2186,12 +2153,12 @@ public abstract class World implements IBlockAccess { int l3; if (k1 > j1) { - this.H[i1++] = 133152; + this.I[i1++] = 133152; } else if (k1 < j1) { - this.H[i1++] = 133152 | j1 << 18; + this.I[i1++] = 133152 | j1 << 18; while (l < i1) { - l1 = this.H[l++]; + l1 = this.I[l++]; i2 = (l1 & 63) - 32 + i; j2 = (l1 >> 6 & 63) - 32 + j; k2 = (l1 >> 12 & 63) - 32 + k; @@ -2208,11 +2175,11 @@ public abstract class World implements IBlockAccess { int j4 = i2 + Facing.b[i4]; int k4 = j2 + Facing.c[i4]; int l4 = k2 + Facing.d[i4]; - int i5 = Math.max(1, Block.lightBlock[this.getTypeId(j4, k4, l4)]); + int i5 = Math.max(1, this.getType(j4, k4, l4).k()); i3 = this.b(enumskyblock, j4, k4, l4); - if (i3 == l2 - i5 && i1 < this.H.length) { - this.H[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18; + if (i3 == l2 - i5 && i1 < this.I.length) { + this.I[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18; } } } @@ -2227,7 +2194,7 @@ public abstract class World implements IBlockAccess { this.methodProfiler.a("checkedPosition < toCheckCount"); while (l < i1) { - l1 = this.H[l++]; + l1 = this.I[l++]; i2 = (l1 & 63) - 32 + i; j2 = (l1 >> 6 & 63) - 32 + j; k2 = (l1 >> 12 & 63) - 32 + k; @@ -2239,31 +2206,31 @@ public abstract class World implements IBlockAccess { j3 = Math.abs(i2 - i); l3 = Math.abs(j2 - j); k3 = Math.abs(k2 - k); - boolean flag = i1 < this.H.length - 6; + boolean flag = i1 < this.I.length - 6; if (j3 + l3 + k3 < 17 && flag) { if (this.b(enumskyblock, i2 - 1, j2, k2) < i3) { - this.H[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12); + this.I[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12); } if (this.b(enumskyblock, i2 + 1, j2, k2) < i3) { - this.H[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12); + this.I[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12); } if (this.b(enumskyblock, i2, j2 - 1, k2) < i3) { - this.H[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12); + this.I[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12); } if (this.b(enumskyblock, i2, j2 + 1, k2) < i3) { - this.H[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12); + this.I[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12); } if (this.b(enumskyblock, i2, j2, k2 - 1) < i3) { - this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12); + this.I[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12); } if (this.b(enumskyblock, i2, j2, k2 + 1) < i3) { - this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12); + this.I[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12); } } } @@ -2271,6 +2238,7 @@ public abstract class World implements IBlockAccess { } this.methodProfiler.b(); + return true; } } @@ -2370,9 +2338,10 @@ public abstract class World implements IBlockAccess { } if (oclass.isAssignableFrom(entity.getClass())) { + // if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) { + // CraftBukkit end ++i; } - // CraftBukkit end } return i; @@ -2380,7 +2349,9 @@ public abstract class World implements IBlockAccess { public void a(List list) { // CraftBukkit start + // this.entityList.addAll(list); Entity entity = null; + for (int i = 0; i < list.size(); ++i) { entity = (Entity) list.get(i); if (entity == null) { @@ -2396,31 +2367,15 @@ public abstract class World implements IBlockAccess { this.f.addAll(list); } - public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1, Entity entity, ItemStack itemstack) { - int j1 = this.getTypeId(j, k, l); - Block block = Block.byId[j1]; - Block block1 = Block.byId[i]; - AxisAlignedBB axisalignedbb = block1.b(this, j, k, l); + public boolean mayPlace(Block block, int i, int j, int k, boolean flag, int l, Entity entity, ItemStack itemstack) { + Block block1 = this.getType(i, j, k); + AxisAlignedBB axisalignedbb = flag ? null : block.a(this, i, j, k); - if (flag) { - axisalignedbb = null; - } - - boolean defaultReturn; // CraftBukkit - store the default action - - if (axisalignedbb != null && !this.a(axisalignedbb, entity)) { - defaultReturn = false; // CraftBukkit - } else { - if (block != null && (block == Block.WATER || block == Block.STATIONARY_WATER || block == Block.LAVA || block == Block.STATIONARY_LAVA || block == Block.FIRE || block.material.isReplaceable())) { - block = null; - } - - // CraftBukkit - defaultReturn = block != null && block.material == Material.ORIENTABLE && block1 == Block.ANVIL ? true : i > 0 && block == null && block1.canPlace(this, j, k, l, i1, itemstack); - } + // CraftBukkit start - store default return + boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb, entity) ? false : (block1.getMaterial() == Material.ORIENTABLE && block == Blocks.ANVIL ? true : block1.getMaterial().isReplaceable() && block.canPlace(this, i, j, k, l, itemstack)); // CraftBukkit start - BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(j, k, l), i, defaultReturn); + BlockCanBuildEvent event = new BlockCanBuildEvent(this.getWorld().getBlockAt(i, j, k), CraftMagicNumbers.getId(block), defaultReturn); this.getServer().getPluginManager().callEvent(event); return event.isBuildable(); @@ -2466,9 +2421,7 @@ public abstract class World implements IBlockAccess { } public int getBlockPower(int i, int j, int k, int l) { - int i1 = this.getTypeId(i, j, k); - - return i1 == 0 ? 0 : Block.byId[i1].c(this, i, j, k, l); + return this.getType(i, j, k).c(this, i, j, k, l); } public int getBlockPower(int i, int j, int k) { @@ -2508,13 +2461,7 @@ public abstract class World implements IBlockAccess { } public int getBlockFacePower(int i, int j, int k, int l) { - if (this.u(i, j, k)) { - return this.getBlockPower(i, j, k); - } else { - int i1 = this.getTypeId(i, j, k); - - return i1 == 0 ? 0 : Block.byId[i1].b(this, i, j, k, l); - } + return this.getType(i, j, k).r() ? this.getBlockPower(i, j, k) : this.getType(i, j, k).b(this, i, j, k, l); } public boolean isBlockIndirectlyPowered(int i, int j, int k) { @@ -2590,7 +2537,7 @@ public abstract class World implements IBlockAccess { } if (entityhuman1.isInvisible()) { - float f = entityhuman1.bx(); + float f = entityhuman1.bC(); if (f < 0.1F) { f = 0.1F; @@ -2619,7 +2566,7 @@ public abstract class World implements IBlockAccess { return null; } - public void G() throws ExceptionWorldConflict { // CraftBukkit - added throws + public void F() throws ExceptionWorldConflict { // CraftBukkit - added throws this.dataManager.checkSession(); } @@ -2643,20 +2590,22 @@ public abstract class World implements IBlockAccess { return new ChunkCoordinates(this.worldData.c(), this.worldData.d(), this.worldData.e()); } + public void x(int i, int j, int k) { + this.worldData.setSpawn(i, j, k); + } + public boolean a(EntityHuman entityhuman, int i, int j, int k) { return true; } public void broadcastEntityEffect(Entity entity, byte b0) {} - public IChunkProvider L() { + public IChunkProvider K() { return this.chunkProvider; } - public void playNote(int i, int j, int k, int l, int i1, int j1) { - if (l > 0) { - Block.byId[l].b(this, i, j, k, i1, j1); - } + public void playNote(int i, int j, int k, Block block, int l, int i1) { + block.a(this, i, j, k, l, i1); } public IDataManager getDataManager() { @@ -2684,46 +2633,46 @@ public abstract class World implements IBlockAccess { // CraftBukkit end public float h(float f) { - return (this.o + (this.p - this.o) * f) * this.i(f); + return (this.o + (this.p - this.o) * f) * this.j(f); } - public float i(float f) { + public float j(float f) { return this.m + (this.n - this.m) * f; } - public boolean P() { + public boolean O() { return (double) this.h(1.0F) > 0.9D; } - public boolean Q() { - return (double) this.i(1.0F) > 0.2D; + public boolean P() { + return (double) this.j(1.0F) > 0.2D; } public boolean isRainingAt(int i, int j, int k) { - if (!this.Q()) { + if (!this.P()) { return false; - } else if (!this.l(i, j, k)) { + } else if (!this.i(i, j, k)) { return false; } else if (this.h(i, k) > j) { return false; } else { BiomeBase biomebase = this.getBiome(i, k); - return biomebase.c() ? false : biomebase.d(); + return biomebase.d() ? false : (this.e(i, j, k, false) ? false : biomebase.e()); } } - public boolean G(int i, int j, int k) { + public boolean z(int i, int j, int k) { BiomeBase biomebase = this.getBiome(i, k); - return biomebase.e(); + return biomebase.f(); } - public void a(String s, WorldMapBase worldmapbase) { - this.worldMaps.a(s, worldmapbase); + public void a(String s, PersistentBase persistentbase) { + this.worldMaps.a(s, persistentbase); } - public WorldMapBase a(Class oclass, String s) { + public PersistentBase a(Class oclass, String s) { return this.worldMaps.get(oclass, s); } @@ -2731,7 +2680,7 @@ public abstract class World implements IBlockAccess { return this.worldMaps.a(s); } - public void d(int i, int j, int k, int l, int i1) { + public void b(int i, int j, int k, int l, int i1) { for (int j1 = 0; j1 < this.u.size(); ++j1) { ((IWorldAccess) this.u.get(j1)).a(i, j, k, l, i1); } @@ -2762,15 +2711,11 @@ public abstract class World implements IBlockAccess { return 256; } - public int S() { + public int R() { return this.worldProvider.g ? 128 : 256; } - public IUpdatePlayerListBox a(EntityMinecartAbstract entityminecartabstract) { - return null; - } - - public Random H(int i, int j, int k) { + public Random A(int i, int j, int k) { long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k; this.random.setSeed(l); @@ -2778,7 +2723,7 @@ public abstract class World implements IBlockAccess { } public ChunkPosition b(String s, int i, int j, int k) { - return this.L().findNearestMapFeature(this, s, i, j, k); + return this.K().findNearestMapFeature(this, s, i, j, k); } public CrashReportSystemDetails a(CrashReport crashreport) { @@ -2797,7 +2742,7 @@ public abstract class World implements IBlockAccess { return crashreportsystemdetails; } - public void f(int i, int j, int k, int l, int i1) { + public void d(int i, int j, int k, int l, int i1) { for (int j1 = 0; j1 < this.u.size(); ++j1) { IWorldAccess iworldaccess = (IWorldAccess) this.u.get(j1); @@ -2809,9 +2754,9 @@ public abstract class World implements IBlockAccess { return this.J; } - public Calendar W() { + public Calendar V() { if (this.getTime() % 600L == 0L) { - this.K.setTimeInMillis(MinecraftServer.aq()); + this.K.setTimeInMillis(MinecraftServer.ap()); } return this.K; @@ -2821,53 +2766,55 @@ public abstract class World implements IBlockAccess { return this.scoreboard; } - public void m(int i, int j, int k, int l) { - for (int i1 = 0; i1 < 4; ++i1) { - int j1 = i + Direction.a[i1]; - int k1 = k + Direction.b[i1]; - int l1 = this.getTypeId(j1, j, k1); + public void f(int i, int j, int k, Block block) { + for (int l = 0; l < 4; ++l) { + int i1 = i + Direction.a[l]; + int j1 = k + Direction.b[l]; + Block block1 = this.getType(i1, j, j1); - if (l1 != 0) { - Block block = Block.byId[l1]; + if (Blocks.REDSTONE_COMPARATOR_OFF.e(block1)) { + block1.doPhysics(this, i1, j, j1, block); + } else if (block1.r()) { + i1 += Direction.a[l]; + j1 += Direction.b[l]; + Block block2 = this.getType(i1, j, j1); - if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) { - block.doPhysics(this, j1, j, k1, l); - } else if (Block.l(l1)) { - j1 += Direction.a[i1]; - k1 += Direction.b[i1]; - l1 = this.getTypeId(j1, j, k1); - block = Block.byId[l1]; - if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) { - block.doPhysics(this, j1, j, k1, l); - } + if (Blocks.REDSTONE_COMPARATOR_OFF.e(block2)) { + block2.doPhysics(this, i1, j, j1, block); } } } } - public IConsoleLogManager getLogger() { - return this.logAgent; - } - public float b(double d0, double d1, double d2) { - return this.I(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); + return this.B(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } - public float I(int i, int j, int k) { + public float B(int i, int j, int k) { float f = 0.0F; - boolean flag = this.difficulty == 3; + boolean flag = this.difficulty == EnumDifficulty.HARD; if (this.isLoaded(i, j, k)) { float f1 = this.x(); - f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).q / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F); + f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).s / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F); f += f1 * 0.25F; } - if (this.difficulty < 2) { - f *= (float) this.difficulty / 2.0F; + if (this.difficulty == EnumDifficulty.EASY || this.difficulty == EnumDifficulty.PEACEFUL) { + f *= (float) this.difficulty.a() / 2.0F; } return MathHelper.a(f, 0.0F, flag ? 1.5F : 1.0F); } + + public void X() { + Iterator iterator = this.u.iterator(); + + while (iterator.hasNext()) { + IWorldAccess iworldaccess = (IWorldAccess) iterator.next(); + + iworldaccess.b(); + } + } } diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/MinecraftInventory.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/MinecraftInventory.java deleted file mode 100644 index 6399c1460..000000000 --- a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/MinecraftInventory.java +++ /dev/null @@ -1,142 +0,0 @@ -package org.bukkit.craftbukkit.v1_6_R3.inventory; - -import java.util.ArrayList; -import java.util.List; - -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHumanEntity; -import org.bukkit.entity.HumanEntity; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.inventory.InventoryHolder; - -import net.minecraft.server.v1_6_R3.EntityHuman; -import net.minecraft.server.v1_6_R3.IInventory; -import net.minecraft.server.v1_6_R3.ItemStack; - -public class MinecraftInventory implements IInventory { - private final ItemStack[] items; - private int maxStack = MAX_STACK; - private final List viewers; - private String title; - private InventoryType type; - private final InventoryHolder owner; - - public MinecraftInventory(InventoryHolder owner, InventoryType type) { - this(owner, type.getDefaultSize(), type.getDefaultTitle()); - this.type = type; - } - - public MinecraftInventory(InventoryHolder owner, int size) { - this(owner, size, "Chest"); - } - - public MinecraftInventory(InventoryHolder owner, int size, String title) { - this.items = new ItemStack[size]; - this.title = title; - this.viewers = new ArrayList(); - this.owner = owner; - this.type = InventoryType.CHEST; - } - - public int getSize() { - return items.length; - } - - public ItemStack getItem(int i) { - return items[i]; - } - - public ItemStack splitStack(int i, int j) { - ItemStack stack = this.getItem(i); - ItemStack result; - if (stack == null) return null; - if (stack.count <= j) { - this.setItem(i, null); - result = stack; - } else { - result = CraftItemStack.copyNMSStack(stack, j); - stack.count -= j; - } - this.update(); - return result; - } - - public ItemStack splitWithoutUpdate(int i) { - ItemStack stack = this.getItem(i); - ItemStack result; - if (stack == null) return null; - if (stack.count <= 1) { - this.setItem(i, null); - result = stack; - } else { - result = CraftItemStack.copyNMSStack(stack, 1); - stack.count -= 1; - } - return result; - } - - public void setItem(int i, ItemStack itemstack) { - items[i] = itemstack; - if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) { - itemstack.count = this.getMaxStackSize(); - } - } - - public void setName(String name) { - title = name; - } - - public String getName() { - return title; - } - - public int getMaxStackSize() { - return maxStack; - } - - public void setMaxStackSize(int size) { - maxStack = size; - } - - public void update() {} - - public boolean a(EntityHuman entityhuman) { - return true; - } - - public ItemStack[] getContents() { - return items; - } - - public void onOpen(CraftHumanEntity who) { - viewers.add(who); - } - - public void onClose(CraftHumanEntity who) { - viewers.remove(who); - } - - public List getViewers() { - return viewers; - } - - public InventoryType getType() { - return type; - } - - public void g() {} - - public InventoryHolder getOwner() { - return owner; - } - - public void startOpen() {} - - public boolean c() { - return false; - } - - public boolean b(int i, ItemStack itemstack) { - return true; - } -} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/entity/CraftPlayer.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/entity/CraftPlayer.java similarity index 71% rename from Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/entity/CraftPlayer.java rename to Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/entity/CraftPlayer.java index 8210c6667..18b3735e1 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/entity/CraftPlayer.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/entity/CraftPlayer.java @@ -1,4 +1,4 @@ -package org.bukkit.craftbukkit.v1_6_R3.entity; +package org.bukkit.craftbukkit.v1_7_R1.entity; import com.google.common.collect.ImmutableSet; import com.google.common.collect.MapMaker; @@ -16,32 +16,33 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import net.minecraft.server.v1_6_R3.*; +import net.minecraft.server.v1_7_R1.*; +import net.minecraft.server.v1_7_R1.BanEntry; import org.apache.commons.lang.Validate; import org.apache.commons.lang.NotImplementedException; - import org.bukkit.*; import org.bukkit.Achievement; import org.bukkit.Material; import org.bukkit.Statistic; +import org.bukkit.Statistic.Type; import org.bukkit.World; import org.bukkit.configuration.serialization.DelegateDeserialization; import org.bukkit.conversations.Conversation; import org.bukkit.conversations.ConversationAbandonedEvent; import org.bukkit.conversations.ManuallyAbandonedConversationCanceller; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftHumanEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_6_R3.conversations.ConversationTracker; -import org.bukkit.craftbukkit.v1_6_R3.CraftEffect; -import org.bukkit.craftbukkit.v1_6_R3.CraftOfflinePlayer; -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.CraftSound; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.map.CraftMapView; -import org.bukkit.craftbukkit.v1_6_R3.map.RenderData; -import org.bukkit.craftbukkit.v1_6_R3.scoreboard.CraftScoreboard; -import org.bukkit.entity.Entity; +import org.bukkit.craftbukkit.v1_7_R1.conversations.ConversationTracker; +import org.bukkit.craftbukkit.v1_7_R1.CraftEffect; +import org.bukkit.craftbukkit.v1_7_R1.CraftOfflinePlayer; +import org.bukkit.craftbukkit.v1_7_R1.CraftServer; +import org.bukkit.craftbukkit.v1_7_R1.CraftSound; +import org.bukkit.craftbukkit.v1_7_R1.CraftStatistic; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.map.CraftMapView; +import org.bukkit.craftbukkit.v1_7_R1.map.RenderData; +import org.bukkit.craftbukkit.v1_7_R1.scoreboard.CraftScoreboard; +import org.bukkit.craftbukkit.v1_7_R1.util.CraftChatMessage; +import org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerGameModeChangeEvent; @@ -52,7 +53,6 @@ import org.bukkit.inventory.InventoryView.Property; import org.bukkit.map.MapView; import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; -import org.bukkit.plugin.messaging.Messenger; import org.bukkit.plugin.messaging.StandardMessenger; import org.bukkit.scoreboard.Scoreboard; @@ -132,36 +132,45 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } + @Override public void sendRawMessage(String message) { if (getHandle().playerConnection == null) return; - getHandle().playerConnection.sendPacket(new Packet3Chat(ChatMessage.d(message))); + for (IChatBaseComponent component : CraftChatMessage.fromString(message)) { + getHandle().playerConnection.sendPacket(new PacketPlayOutChat(component)); + } } + @Override public void sendMessage(String message) { if (!conversationTracker.isConversingModaly()) { this.sendRawMessage(message); } } + @Override public void sendMessage(String[] messages) { for (String message : messages) { sendMessage(message); } } + @Override public String getDisplayName() { return getHandle().displayName; } + @Override public void setDisplayName(final String name) { getHandle().displayName = name; } + @Override public String getPlayerListName() { return getHandle().listName; } + @Override public void setPlayerListName(String name) { String oldName = getHandle().listName; @@ -187,8 +196,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getHandle().listName = name; // Change the name on the client side - Packet201PlayerInfo oldpacket = new Packet201PlayerInfo(oldName, false, 9999); - Packet201PlayerInfo packet = new Packet201PlayerInfo(name, true, getHandle().ping); + PacketPlayOutPlayerInfo oldpacket = new PacketPlayOutPlayerInfo(oldName, false, 9999); + PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(name, true, getHandle().ping); for (int i = 0; i < server.getHandle().players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) server.getHandle().players.get(i); if (entityplayer.playerConnection == null) continue; @@ -220,54 +229,97 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return nameEquals && idEquals; } + @Override public void kickPlayer(String message) { if (getHandle().playerConnection == null) return; getHandle().playerConnection.disconnect(message == null ? "" : message); } + @Override public void setCompassTarget(Location loc) { if (getHandle().playerConnection == null) return; // Do not directly assign here, from the packethandler we'll assign it. - getHandle().playerConnection.sendPacket(new Packet6SpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); + getHandle().playerConnection.sendPacket(new PacketPlayOutSpawnPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ())); } + @Override public Location getCompassTarget() { return getHandle().compassTarget; } + @Override public void chat(String msg) { if (getHandle().playerConnection == null) return; getHandle().playerConnection.chat(msg, false); } + @Override public boolean performCommand(String command) { return server.dispatchCommand(this, command); } + @Override public void playNote(Location loc, byte instrument, byte note) { if (getHandle().playerConnection == null) return; - int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); - getHandle().playerConnection.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument, note)); + String instrumentName = null; + switch (instrument) { + case 0: + instrumentName = "harp"; + break; + case 1: + instrumentName = "bd"; + break; + case 2: + instrumentName = "snare"; + break; + case 3: + instrumentName = "hat"; + break; + case 4: + instrumentName = "bassattack"; + break; + } + getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("note."+instrumentName, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, note)); } + @Override public void playNote(Location loc, Instrument instrument, Note note) { if (getHandle().playerConnection == null) return; - int id = getHandle().world.getTypeId(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); - getHandle().playerConnection.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), id, instrument.getType(), note.getId())); + String instrumentName = null; + switch (instrument.ordinal()) { + case 0: + instrumentName = "harp"; + break; + case 1: + instrumentName = "bd"; + break; + case 2: + instrumentName = "snare"; + break; + case 3: + instrumentName = "hat"; + break; + case 4: + instrumentName = "bassattack"; + break; + } + getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("note."+instrumentName, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, note.getId())); } + @Override public void playSound(Location loc, Sound sound, float volume, float pitch) { - if (sound == null) { - return; - } - playSound(loc, CraftSound.getSound(sound), volume, pitch); + if (sound == null) { + return; + } + playSound(loc, CraftSound.getSound(sound), volume, pitch); } - + + @Override public void playSound(Location loc, String sound, float volume, float pitch) { if (loc == null || sound == null || getHandle().playerConnection == null) return; @@ -275,18 +327,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { double y = loc.getBlockY() + 0.5; double z = loc.getBlockZ() + 0.5; - Packet62NamedSoundEffect packet = new Packet62NamedSoundEffect(sound, x, y, z, volume, pitch); + PacketPlayOutNamedSoundEffect packet = new PacketPlayOutNamedSoundEffect(sound, x, y, z, volume, pitch); getHandle().playerConnection.sendPacket(packet); } + @Override public void playEffect(Location loc, Effect effect, int data) { if (getHandle().playerConnection == null) return; int packetData = effect.getId(); - Packet61WorldEvent packet = new Packet61WorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false); + PacketPlayOutWorldEvent packet = new PacketPlayOutWorldEvent(packetData, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), data, false); getHandle().playerConnection.sendPacket(packet); } + @Override public void playEffect(Location loc, Effect effect, T data) { if (data != null) { Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!"); @@ -298,20 +352,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { playEffect(loc, effect, datavalue); } + @Override public void sendBlockChange(Location loc, Material material, byte data) { sendBlockChange(loc, material.getId(), data); } + @Override public void sendBlockChange(Location loc, int material, byte data) { if (getHandle().playerConnection == null) return; - Packet53BlockChange packet = new Packet53BlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle()); + PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle()); - packet.material = material; + packet.block = CraftMagicNumbers.getBlock(material); packet.data = data; getHandle().playerConnection.sendPacket(packet); } + @Override public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data) { if (getHandle().playerConnection == null) return false; @@ -345,6 +402,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { throw new NotImplementedException("Chunk changes do not yet work"); // TODO: Chunk changes. } + @Override public void sendMap(MapView map) { if (getHandle().playerConnection == null) return; @@ -355,7 +413,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { for (int y = 0; y < 128; ++y) { bytes[y + 3] = data.buffer[y * 128 + x]; } - Packet131ItemData packet = new Packet131ItemData((short) Material.MAP.getId(), map.getId(), bytes); + PacketPlayOutMap packet = new PacketPlayOutMap(map.getId(), bytes); getHandle().playerConnection.sendPacket(packet); } } @@ -368,7 +426,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return false; } - if (entity.playerConnection == null || entity.playerConnection.disconnected) { + if (entity.playerConnection == null || entity.playerConnection.isDisconnected()) { return false; } @@ -411,125 +469,251 @@ public class CraftPlayer extends CraftHumanEntity implements Player { return true; } + @Override public void setSneaking(boolean sneak) { getHandle().setSneaking(sneak); } + @Override public boolean isSneaking() { return getHandle().isSneaking(); } + @Override public boolean isSprinting() { return getHandle().isSprinting(); } + @Override public void setSprinting(boolean sprinting) { getHandle().setSprinting(sprinting); } + @Override public void loadData() { server.getHandle().playerFileData.load(getHandle()); } + @Override public void saveData() { server.getHandle().playerFileData.save(getHandle()); } @Deprecated + @Override public void updateInventory() { getHandle().updateInventory(getHandle().activeContainer); } + @Override public void setSleepingIgnored(boolean isSleeping) { getHandle().fauxSleeping = isSleeping; ((CraftWorld) getWorld()).getHandle().checkSleepStatus(); } + @Override public boolean isSleepingIgnored() { return getHandle().fauxSleeping; } + @Override public void awardAchievement(Achievement achievement) { - sendStatistic(achievement.getId(), 1); + Validate.notNull(achievement, "Achievement cannot be null"); + if (achievement.hasParent() && !hasAchievement(achievement.getParent())) { + awardAchievement(achievement.getParent()); + } + getHandle().x().a(getHandle(), CraftStatistic.getNMSAchievement(achievement), 1); + getHandle().x().b(getHandle()); } + @Override + public void removeAchievement(Achievement achievement) { + Validate.notNull(achievement, "Achievement cannot be null"); + for (Achievement achieve : Achievement.values()) { + if (achieve.getParent() == achievement && hasAchievement(achieve)) { + removeAchievement(achieve); + } + } + getHandle().x().a(getHandle(), CraftStatistic.getNMSAchievement(achievement), 0); + } + + @Override + public boolean hasAchievement(Achievement achievement) { + Validate.notNull(achievement, "Achievement cannot be null"); + return getHandle().x().a(CraftStatistic.getNMSAchievement(achievement)); + } + + @Override public void incrementStatistic(Statistic statistic) { incrementStatistic(statistic, 1); } - public void incrementStatistic(Statistic statistic, int amount) { - sendStatistic(statistic.getId(), amount); + @Override + public void decrementStatistic(Statistic statistic) { + decrementStatistic(statistic, 1); } + @Override + public int getStatistic(Statistic statistic) { + Validate.notNull(statistic, "Statistic cannot be null"); + Validate.isTrue(statistic.getType() == Type.UNTYPED, "Must supply additional paramater for this statistic"); + return getHandle().x().a(CraftStatistic.getNMSStatistic(statistic)); + } + + @Override + public void incrementStatistic(Statistic statistic, int amount) { + Validate.isTrue(amount > 0, "Amount must be greater than 0"); + setStatistic(statistic, getStatistic(statistic) + amount); + } + + @Override + public void decrementStatistic(Statistic statistic, int amount) { + Validate.isTrue(amount > 0, "Amount must be greater than 0"); + setStatistic(statistic, getStatistic(statistic) - amount); + } + + @Override + public void setStatistic(Statistic statistic, int newValue) { + Validate.notNull(statistic, "Statistic cannot be null"); + Validate.isTrue(statistic.getType() == Type.UNTYPED, "Must supply additional paramater for this statistic"); + Validate.isTrue(newValue >= 0, "Value must be greater than or equal to 0"); + net.minecraft.server.v1_7_R1.Statistic nmsStatistic = CraftStatistic.getNMSStatistic(statistic); + getHandle().x().a(getHandle(), nmsStatistic, newValue); + } + + @Override public void incrementStatistic(Statistic statistic, Material material) { incrementStatistic(statistic, material, 1); } + @Override + public void decrementStatistic(Statistic statistic, Material material) { + decrementStatistic(statistic, material, 1); + } + + @Override + public int getStatistic(Statistic statistic, Material material) { + Validate.notNull(statistic, "Statistic cannot be null"); + Validate.notNull(material, "Material cannot be null"); + Validate.isTrue(statistic.getType() == Type.BLOCK || statistic.getType() == Type.ITEM, "This statistic does not take a Material parameter"); + net.minecraft.server.v1_7_R1.Statistic nmsStatistic = CraftStatistic.getMaterialStatistic(statistic, material); + Validate.notNull(nmsStatistic, "The supplied Material does not have a corresponding statistic"); + return getHandle().x().a(nmsStatistic); + } + + @Override public void incrementStatistic(Statistic statistic, Material material, int amount) { - if (!statistic.isSubstatistic()) { - throw new IllegalArgumentException("Given statistic is not a substatistic"); - } - if (statistic.isBlock() != material.isBlock()) { - throw new IllegalArgumentException("Given material is not valid for this substatistic"); - } - - int mat = material.getId(); - - if (!material.isBlock()) { - mat -= 255; - } - - sendStatistic(statistic.getId() + mat, amount); + Validate.isTrue(amount > 0, "Amount must be greater than 0"); + setStatistic(statistic, material, getStatistic(statistic, material) + amount); } - private void sendStatistic(int id, int amount) { - if (getHandle().playerConnection == null) return; - - while (amount > Byte.MAX_VALUE) { - sendStatistic(id, Byte.MAX_VALUE); - amount -= Byte.MAX_VALUE; - } - - getHandle().playerConnection.sendPacket(new Packet200Statistic(id, amount)); + @Override + public void decrementStatistic(Statistic statistic, Material material, int amount) { + Validate.isTrue(amount > 0, "Amount must be greater than 0"); + setStatistic(statistic, material, getStatistic(statistic, material) - amount); } + @Override + public void setStatistic(Statistic statistic, Material material, int newValue) { + Validate.notNull(statistic, "Statistic cannot be null"); + Validate.notNull(material, "Material cannot be null"); + Validate.isTrue(newValue >= 0, "Value must be greater than or equal to 0"); + Validate.isTrue(statistic.getType() == Type.BLOCK || statistic.getType() == Type.ITEM, "This statistic does not take a Material parameter"); + net.minecraft.server.v1_7_R1.Statistic nmsStatistic = CraftStatistic.getMaterialStatistic(statistic, material); + Validate.notNull(nmsStatistic, "The supplied Material does not have a corresponding statistic"); + getHandle().x().a(getHandle(), nmsStatistic, newValue); + } + + @Override + public void incrementStatistic(Statistic statistic, EntityType entityType) { + incrementStatistic(statistic, entityType, 1); + } + + @Override + public void decrementStatistic(Statistic statistic, EntityType entityType) { + decrementStatistic(statistic, entityType, 1); + } + + @Override + public int getStatistic(Statistic statistic, EntityType entityType) { + Validate.notNull(statistic, "Statistic cannot be null"); + Validate.notNull(entityType, "EntityType cannot be null"); + Validate.isTrue(statistic.getType() == Type.ENTITY, "This statistic does not take an EntityType parameter"); + net.minecraft.server.v1_7_R1.Statistic nmsStatistic = CraftStatistic.getEntityStatistic(statistic, entityType); + Validate.notNull(nmsStatistic, "The supplied EntityType does not have a corresponding statistic"); + return getHandle().x().a(nmsStatistic); + } + + @Override + public void incrementStatistic(Statistic statistic, EntityType entityType, int amount) { + Validate.isTrue(amount > 0, "Amount must be greater than 0"); + setStatistic(statistic, entityType, getStatistic(statistic, entityType) + amount); + } + + @Override + public void decrementStatistic(Statistic statistic, EntityType entityType, int amount) { + Validate.isTrue(amount > 0, "Amount must be greater than 0"); + setStatistic(statistic, entityType, getStatistic(statistic, entityType) - amount); + } + + @Override + public void setStatistic(Statistic statistic, EntityType entityType, int newValue) { + Validate.notNull(statistic, "Statistic cannot be null"); + Validate.notNull(entityType, "EntityType cannot be null"); + Validate.isTrue(newValue >= 0, "Value must be greater than or equal to 0"); + Validate.isTrue(statistic.getType() == Type.ENTITY, "This statistic does not take an EntityType parameter"); + net.minecraft.server.v1_7_R1.Statistic nmsStatistic = CraftStatistic.getEntityStatistic(statistic, entityType); + Validate.notNull(nmsStatistic, "The supplied EntityType does not have a corresponding statistic"); + getHandle().x().a(getHandle(), nmsStatistic, newValue); + } + + @Override public void setPlayerTime(long time, boolean relative) { getHandle().timeOffset = time; getHandle().relativeTime = relative; } + @Override public long getPlayerTimeOffset() { return getHandle().timeOffset; } + @Override public long getPlayerTime() { return getHandle().getPlayerTime(); } + @Override public boolean isPlayerTimeRelative() { return getHandle().relativeTime; } + @Override public void resetPlayerTime() { setPlayerTime(0, true); } + @Override public void setPlayerWeather(WeatherType type) { getHandle().setPlayerWeather(type, true); } + @Override public WeatherType getPlayerWeather() { return getHandle().getPlayerWeather(); } + @Override public void resetPlayerWeather() { getHandle().resetPlayerWeather(); } + @Override public boolean isBanned() { return server.getHandle().getNameBans().isBanned(getName().toLowerCase()); } + @Override public void setBanned(boolean value) { if (value) { BanEntry entry = new BanEntry(getName().toLowerCase()); @@ -541,10 +725,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { server.getHandle().getNameBans().save(); } + @Override public boolean isWhitelisted() { return server.getHandle().getWhitelisted().contains(getName().toLowerCase()); } + @Override public void setWhitelisted(boolean value) { if (value) { server.getHandle().addWhitelist(getName().toLowerCase()); @@ -569,7 +755,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } getHandle().playerInteractManager.setGameMode(EnumGamemode.a(mode.getValue())); - getHandle().playerConnection.sendPacket(new Packet70Bed(3, mode.getValue())); + getHandle().fallDistance = 0; + getHandle().playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, mode.getValue())); } } @@ -676,14 +863,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { //remove this player from the hidden player's EntityTrackerEntry EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityPlayer other = ((CraftPlayer) player).getHandle(); - EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id); + EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.getId()); if (entry != null) { entry.clear(getHandle()); } //remove the hidden player from this player user list if (hideList) - getHandle().playerConnection.sendPacket(new Packet201PlayerInfo(player.getPlayerListName(), false, 9999)); + getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), false, 9999)); } public void showPlayer(Player player) { @@ -695,12 +882,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityPlayer other = ((CraftPlayer) player).getHandle(); - EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id); + EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.getId()); if (entry != null && !entry.trackedPlayers.contains(getHandle())) { entry.updatePlayer(getHandle()); } - getHandle().playerConnection.sendPacket(new Packet201PlayerInfo(player.getPlayerListName(), true, getHandle().ping)); + getHandle().playerConnection.sendPacket(new PacketPlayOutPlayerInfo(player.getPlayerListName(), true, getHandle().ping)); } public boolean canSee(Player player) { @@ -780,7 +967,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void setExtraData(NBTTagCompound nbttagcompound) { if (!nbttagcompound.hasKey("bukkit")) { - nbttagcompound.setCompound("bukkit", new NBTTagCompound()); + nbttagcompound.set("bukkit", new NBTTagCompound()); } NBTTagCompound data = nbttagcompound.getCompound("bukkit"); @@ -819,21 +1006,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (getHandle().playerConnection == null) return; if (channels.contains(channel)) { - Packet250CustomPayload packet = new Packet250CustomPayload(); - packet.tag = channel; - packet.length = message.length; - packet.data = message; + PacketPlayOutCustomPayload packet = new PacketPlayOutCustomPayload(channel, message); getHandle().playerConnection.sendPacket(packet); } } public void setTexturePack(String url) { - Validate.notNull(url, "Texture pack URL cannot be null"); + setResourcePack(url); + } - byte[] message = (url + "\0" + "16").getBytes(); - Validate.isTrue(message.length <= Messenger.MAX_MESSAGE_SIZE, "Texture pack URL is too long"); + @Override + public void setResourcePack(String url) { + Validate.notNull(url, "Resource pack URL cannot be null"); - getHandle().playerConnection.sendPacket(new Packet250CustomPayload("MC|TPack", message)); + getHandle().a(url); // should be setResourcePack } public void addChannel(String channel) { @@ -857,9 +1043,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { Set listening = server.getMessenger().getIncomingChannels(); if (!listening.isEmpty()) { - Packet250CustomPayload packet = new Packet250CustomPayload(); - - packet.tag = "REGISTER"; ByteArrayOutputStream stream = new ByteArrayOutputStream(); for (String channel : listening) { @@ -871,10 +1054,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } } - packet.data = stream.toByteArray(); - packet.length = packet.data.length; - - getHandle().playerConnection.sendPacket(packet); + getHandle().playerConnection.sendPacket(new PacketPlayOutCustomPayload("REGISTER", stream.toByteArray())); } } @@ -1011,7 +1191,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { if (playerConnection == null) { throw new IllegalStateException("Cannot set scoreboard yet"); } - if (playerConnection.disconnected) { + if (playerConnection.isDisconnected()) { throw new IllegalStateException("Cannot set scoreboard for invalid CraftPlayer"); } @@ -1053,14 +1233,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void updateScaledHealth() { - AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().aX(); + AttributeMapServer attributemapserver = (AttributeMapServer) getHandle().bc(); Set set = attributemapserver.b(); injectScaledMaxHealth(set, true); getHandle().getDataWatcher().watch(6, (float) getScaledHealth()); - getHandle().playerConnection.sendPacket(new Packet8UpdateHealth(getScaledHealth(), getHandle().getFoodData().a(), getHandle().getFoodData().e())); - getHandle().playerConnection.sendPacket(new Packet44UpdateAttributes(getHandle().id, set)); + getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateHealth(getScaledHealth(), getHandle().getFoodData().a(), getHandle().getFoodData().e())); + getHandle().playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(getHandle().getId(), set)); set.clear(); getHandle().maxHealthCache = getMaxHealth(); @@ -1078,6 +1258,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } continue; } - collection.add(new AttributeModifiable(getHandle().aX(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); + collection.add(new AttributeModifiable(getHandle().bc(), (new AttributeRanged("generic.maxHealth", scaledHealth ? healthScale : getMaxHealth(), 0.0D, Float.MAX_VALUE)).a("Max Health").a(true))); } } \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/CraftInventoryCustom.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/CraftInventoryCustom.java similarity index 75% rename from Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/CraftInventoryCustom.java rename to Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/CraftInventoryCustom.java index 434e1a641..f53d570db 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/CraftInventoryCustom.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/CraftInventoryCustom.java @@ -1,6 +1,7 @@ -package org.bukkit.craftbukkit.v1_6_R3.inventory; +package org.bukkit.craftbukkit.v1_7_R1.inventory; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftInventory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.MinecraftInventory; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftInventory; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.InventoryHolder; diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/CraftItemStack.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/CraftItemStack.java similarity index 76% rename from Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/CraftItemStack.java rename to Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/CraftItemStack.java index 0f453fdcf..6bf5a0092 100644 --- a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_6_R3/inventory/CraftItemStack.java +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/CraftItemStack.java @@ -1,29 +1,20 @@ -package org.bukkit.craftbukkit.v1_6_R3.inventory; +package org.bukkit.craftbukkit.v1_7_R1.inventory; -import static org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaItem.ENCHANTMENTS; -import static org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaItem.ENCHANTMENTS_ID; -import static org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaItem.ENCHANTMENTS_LVL; +import static org.bukkit.craftbukkit.v1_7_R1.inventory.CraftMetaItem.ENCHANTMENTS; +import static org.bukkit.craftbukkit.v1_7_R1.inventory.CraftMetaItem.ENCHANTMENTS_ID; +import static org.bukkit.craftbukkit.v1_7_R1.inventory.CraftMetaItem.ENCHANTMENTS_LVL; import java.util.Map; -import net.minecraft.server.v1_6_R3.EnchantmentManager; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.NBTTagList; +import net.minecraft.server.v1_7_R1.EnchantmentManager; +import net.minecraft.server.v1_7_R1.Item; +import net.minecraft.server.v1_7_R1.NBTTagCompound; +import net.minecraft.server.v1_7_R1.NBTTagList; import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.configuration.serialization.DelegateDeserialization; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemFactory; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaBook; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaCharge; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaEnchantedBook; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaFirework; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaItem; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaLeatherArmor; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaMap; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaPotion; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftMetaSkull; +import org.bukkit.craftbukkit.v1_7_R1.util.CraftMagicNumbers; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -33,7 +24,7 @@ import com.google.common.collect.ImmutableMap; @DelegateDeserialization(ItemStack.class) public class CraftItemStack extends ItemStack { - public static net.minecraft.server.v1_6_R3.ItemStack asNMSCopy(ItemStack original) { + public static net.minecraft.server.v1_7_R1.ItemStack asNMSCopy(ItemStack original) { if (original instanceof CraftItemStack) { CraftItemStack stack = (CraftItemStack) original; return stack.handle == null ? null : stack.handle.cloneItemStack(); @@ -41,15 +32,22 @@ public class CraftItemStack extends ItemStack { if (original == null || original.getTypeId() <= 0) { return null; } - net.minecraft.server.v1_6_R3.ItemStack stack = new net.minecraft.server.v1_6_R3.ItemStack(original.getTypeId(), original.getAmount(), original.getDurability()); + + Item item = CraftMagicNumbers.getItem(original.getType()); + + if (item == null) { + return null; + } + + net.minecraft.server.v1_7_R1.ItemStack stack = new net.minecraft.server.v1_7_R1.ItemStack(item, original.getAmount(), original.getDurability()); if (original.hasItemMeta()) { setItemMeta(stack, original.getItemMeta()); } return stack; } - public static net.minecraft.server.v1_6_R3.ItemStack copyNMSStack(net.minecraft.server.v1_6_R3.ItemStack original, int amount) { - net.minecraft.server.v1_6_R3.ItemStack stack = original.cloneItemStack(); + public static net.minecraft.server.v1_7_R1.ItemStack copyNMSStack(net.minecraft.server.v1_7_R1.ItemStack original, int amount) { + net.minecraft.server.v1_7_R1.ItemStack stack = original.cloneItemStack(); stack.count = amount; return stack; } @@ -57,18 +55,18 @@ public class CraftItemStack extends ItemStack { /** * Copies the NMS stack to return as a strictly-Bukkit stack */ - public static ItemStack asBukkitCopy(net.minecraft.server.v1_6_R3.ItemStack original) { + public static ItemStack asBukkitCopy(net.minecraft.server.v1_7_R1.ItemStack original) { if (original == null) { return new ItemStack(Material.AIR); } - ItemStack stack = new ItemStack(original.id, original.count, (short) original.getData()); + ItemStack stack = new ItemStack(CraftMagicNumbers.getMaterial(original.getItem()), original.count, (short) original.getData()); if (hasItemMeta(original)) { stack.setItemMeta(getItemMeta(original)); } return stack; } - public static CraftItemStack asCraftMirror(net.minecraft.server.v1_6_R3.ItemStack original) { + public static CraftItemStack asCraftMirror(net.minecraft.server.v1_7_R1.ItemStack original) { return new CraftItemStack(original); } @@ -80,37 +78,42 @@ public class CraftItemStack extends ItemStack { return new CraftItemStack(original); } - public static CraftItemStack asNewCraftStack(net.minecraft.server.v1_6_R3.Item item) { + public static CraftItemStack asNewCraftStack(Item item) { return asNewCraftStack(item, 1); } - public static CraftItemStack asNewCraftStack(net.minecraft.server.v1_6_R3.Item item, int amount) { - return new CraftItemStack(item.id, amount, (short) 0, null); + public static CraftItemStack asNewCraftStack(Item item, int amount) { + return new CraftItemStack(CraftMagicNumbers.getMaterial(item), amount, (short) 0, null); } - net.minecraft.server.v1_6_R3.ItemStack handle; + net.minecraft.server.v1_7_R1.ItemStack handle; /** * Mirror */ - private CraftItemStack(net.minecraft.server.v1_6_R3.ItemStack item) { + protected CraftItemStack(net.minecraft.server.v1_7_R1.ItemStack item) { this.handle = item; } protected CraftItemStack(ItemStack item) { this(item.getTypeId(), item.getAmount(), item.getDurability(), item.hasItemMeta() ? item.getItemMeta() : null); } - - protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { - setTypeId(typeId); + + protected CraftItemStack(Material type, int amount, short durability, ItemMeta itemMeta) { + setType(type); setAmount(amount); setDurability(durability); setItemMeta(itemMeta); } + protected CraftItemStack(int typeId, int amount, short durability, ItemMeta itemMeta) { + this(Material.getMaterial(typeId), amount, durability, itemMeta); + + } + @Override public int getTypeId() { - return handle != null ? handle.id : 0; + return handle != null ? CraftMagicNumbers.getId(handle.getItem()) : 0; } @Override @@ -119,10 +122,12 @@ public class CraftItemStack extends ItemStack { return; } else if (type == 0) { handle = null; + } else if (CraftMagicNumbers.getItem(type) == null) { // :( + handle = null; } else if (handle == null) { - handle = new net.minecraft.server.v1_6_R3.ItemStack(type, 1, 0); + handle = new net.minecraft.server.v1_7_R1.ItemStack(CraftMagicNumbers.getItem(type), 1, 0); } else { - handle.id = type; + handle.setItem(CraftMagicNumbers.getItem(type)); if (hasItemMeta()) { // This will create the appropriate item meta, which will contain all the data we intend to keep setItemMeta(handle, getItemMeta(handle)); @@ -156,11 +161,6 @@ public class CraftItemStack extends ItemStack { } } - public net.minecraft.server.v1_6_R3.ItemStack getHandle() - { - return handle; - } - @Override public short getDurability() { if (handle != null) { @@ -184,7 +184,7 @@ public class CraftItemStack extends ItemStack { } NBTTagList list = getEnchantmentList(handle); if (list == null) { - list = new NBTTagList(ENCHANTMENTS.NBT); + list = new NBTTagList(); handle.tag.set(ENCHANTMENTS.NBT, list); } int size = list.size(); @@ -203,14 +203,15 @@ public class CraftItemStack extends ItemStack { list.add(tag); } - static boolean makeTag(net.minecraft.server.v1_6_R3.ItemStack item) { + static boolean makeTag(net.minecraft.server.v1_7_R1.ItemStack item) { if (item == null) { return false; } - if (item.tag != null) { - return true; + + if (item.tag == null) { + item.setTag(new NBTTagCompound()); } - item.tag = new NBTTagCompound(); + return true; } @@ -262,7 +263,7 @@ public class CraftItemStack extends ItemStack { } // This is workaround for not having an index removal - listCopy = new NBTTagList(ENCHANTMENTS.NBT); + listCopy = new NBTTagList(); for (int i = 0; i < size; i++) { if (i != index) { listCopy.add(list.get(i)); @@ -278,14 +279,15 @@ public class CraftItemStack extends ItemStack { return getEnchantments(handle); } - static Map getEnchantments(net.minecraft.server.v1_6_R3.ItemStack item) { - ImmutableMap.Builder result = ImmutableMap.builder(); - NBTTagList list = (item == null) ? null : item.getEnchantments(); + static Map getEnchantments(net.minecraft.server.v1_7_R1.ItemStack item) { + NBTTagList list = (item != null && item.hasEnchantments()) ? item.getEnchantments() : null; - if (list == null) { - return result.build(); + if (list == null || list.size() == 0) { + return ImmutableMap.of(); } + ImmutableMap.Builder result = ImmutableMap.builder(); + for (int i = 0; i < list.size(); i++) { int id = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_ID.NBT); int level = 0xffff & ((NBTTagCompound) list.get(i)).getShort(ENCHANTMENTS_LVL.NBT); @@ -296,8 +298,8 @@ public class CraftItemStack extends ItemStack { return result.build(); } - static NBTTagList getEnchantmentList(net.minecraft.server.v1_6_R3.ItemStack item) { - return item == null ? null : item.getEnchantments(); + static NBTTagList getEnchantmentList(net.minecraft.server.v1_7_R1.ItemStack item) { + return (item != null && item.hasEnchantments()) ? item.getEnchantments() : null; } @Override @@ -313,8 +315,12 @@ public class CraftItemStack extends ItemStack { public ItemMeta getItemMeta() { return getItemMeta(handle); } + + public net.minecraft.server.v1_7_R1.ItemStack getHandle() { + return handle; + } - public static ItemMeta getItemMeta(net.minecraft.server.v1_6_R3.ItemStack item) { + public static ItemMeta getItemMeta(net.minecraft.server.v1_7_R1.ItemStack item) { if (!hasItemMeta(item)) { return CraftItemFactory.instance().getItemMeta(getType(item)); } @@ -344,8 +350,8 @@ public class CraftItemStack extends ItemStack { } } - static Material getType(net.minecraft.server.v1_6_R3.ItemStack item) { - Material material = Material.getMaterial(item == null ? 0 : item.id); + static Material getType(net.minecraft.server.v1_7_R1.ItemStack item) { + Material material = Material.getMaterial(item == null ? 0 : CraftMagicNumbers.getId(item.getItem())); return material == null ? Material.AIR : material; } @@ -354,7 +360,7 @@ public class CraftItemStack extends ItemStack { return setItemMeta(handle, itemMeta); } - public static boolean setItemMeta(net.minecraft.server.v1_6_R3.ItemStack item, ItemMeta itemMeta) { + public static boolean setItemMeta(net.minecraft.server.v1_7_R1.ItemStack item, ItemMeta itemMeta) { if (item == null) { return false; } @@ -403,7 +409,7 @@ public class CraftItemStack extends ItemStack { return hasItemMeta(handle); } - static boolean hasItemMeta(net.minecraft.server.v1_6_R3.ItemStack item) { + static boolean hasItemMeta(net.minecraft.server.v1_7_R1.ItemStack item) { return !(item == null || item.tag == null || item.tag.isEmpty()); } -} +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/MinecraftInventory.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/MinecraftInventory.java new file mode 100644 index 000000000..3fa4d4a61 --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/craftbukkit/v1_7_R1/inventory/MinecraftInventory.java @@ -0,0 +1,194 @@ +package org.bukkit.craftbukkit.v1_7_R1.inventory; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftHumanEntity; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; +import org.bukkit.entity.HumanEntity; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.inventory.InventoryHolder; + +import net.minecraft.server.v1_7_R1.EntityHuman; +import net.minecraft.server.v1_7_R1.IInventory; +import net.minecraft.server.v1_7_R1.ItemStack; +import net.minecraft.util.org.apache.commons.lang3.Validate; + +public class MinecraftInventory implements IInventory +{ + private final ItemStack[] items; + private int maxStack = MAX_STACK; + private final List viewers; + private String title; + private InventoryType type; + private final InventoryHolder owner; + + public MinecraftInventory(InventoryHolder owner, InventoryType type) + { + this(owner, type.getDefaultSize(), type.getDefaultTitle()); + this.type = type; + } + + public MinecraftInventory(InventoryHolder owner, int size) + { + this(owner, size, "Chest"); + } + + public MinecraftInventory(InventoryHolder owner, int size, String title) + { + Validate.notNull(title, "Title cannot be null"); + Validate.isTrue(title.length() <= 32, "Title cannot be longer than 32 characters"); + this.items = new ItemStack[size]; + this.title = title; + this.viewers = new ArrayList(); + this.owner = owner; + this.type = InventoryType.CHEST; + } + + public int getSize() + { + return items.length; + } + + public ItemStack getItem(int i) + { + return items[i]; + } + + public ItemStack splitStack(int i, int j) + { + ItemStack stack = this.getItem(i); + ItemStack result; + if (stack == null) + return null; + if (stack.count <= j) + { + this.setItem(i, null); + result = stack; + } + else + { + result = CraftItemStack.copyNMSStack(stack, j); + stack.count -= j; + } + this.update(); + return result; + } + + public ItemStack splitWithoutUpdate(int i) + { + ItemStack stack = this.getItem(i); + ItemStack result; + if (stack == null) + return null; + if (stack.count <= 1) + { + this.setItem(i, null); + result = stack; + } + else + { + result = CraftItemStack.copyNMSStack(stack, 1); + stack.count -= 1; + } + return result; + } + + public void setItem(int i, ItemStack itemstack) + { + items[i] = itemstack; + if (itemstack != null && this.getMaxStackSize() > 0 && itemstack.count > this.getMaxStackSize()) + { + itemstack.count = this.getMaxStackSize(); + } + } + + public void setInventoryName(String name) + { + title = name; + } + + public int getMaxStackSize() + { + return maxStack; + } + + public void setMaxStackSize(int size) + { + maxStack = size; + } + + public void update() + { + } + + public boolean a(EntityHuman entityhuman) + { + return true; + } + + public ItemStack[] getContents() + { + return items; + } + + public void onOpen(CraftHumanEntity who) + { + viewers.add(who); + } + + public void onClose(CraftHumanEntity who) + { + viewers.remove(who); + } + + public List getViewers() + { + return viewers; + } + + public InventoryType getType() + { + return type; + } + + public void g() + { + } + + public InventoryHolder getOwner() + { + return owner; + } + + public void startOpen() + { + } + + public boolean c() + { + return false; + } + + public boolean b(int i, ItemStack itemstack) + { + return true; + } + + @Override + public String getInventoryName() + { + return title; + } + + @Override + public boolean k_() + { + return false; + } + + @Override + public void l_() + { + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/entity/Projectile.java b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/entity/Projectile.java new file mode 100644 index 000000000..289feae9e --- /dev/null +++ b/Plugins/Nautilus.Core.CraftBukkit/src/org/bukkit/entity/Projectile.java @@ -0,0 +1,16 @@ +package org.bukkit.entity; + +import org.bukkit.projectiles.ProjectileSource; + +public abstract interface Projectile extends Entity +{ + @Deprecated + public abstract LivingEntity getShooter(); + + @Deprecated + public abstract void setShooter(LivingEntity paramLivingEntity); + + public abstract boolean doesBounce(); + + public abstract void setBounce(boolean paramBoolean); +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 0c7b78182..71fcff3c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -17,8 +17,8 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockBurnEvent; @@ -501,7 +501,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setExp(0f); ((CraftPlayer)player).getHandle().spectating = false; - ((CraftPlayer)player).getHandle().m = true; + ((CraftPlayer)player).getHandle().l = true; GetCondition().EndCondition(player, ConditionType.CLOAK, null); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 85df9727f..645f32c9e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -35,7 +35,7 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; @@ -758,7 +758,7 @@ public abstract class Game implements Listener player.setFlying(true); player.setFlySpeed(0.1f); ((CraftPlayer)player).getHandle().spectating = true; - ((CraftPlayer)player).getHandle().m = false; + ((CraftPlayer)player).getHandle().l = false; Manager.GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java index 0505dc838..f5850dd16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/CastleSiege.java @@ -14,7 +14,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -57,8 +57,8 @@ import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.games.castlesiege.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class CastleSiege extends TeamGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java index 6a450e593..dfbceb021 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/Sleigh.java @@ -21,7 +21,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java index 7d39d70e1..16abd5606 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/SleighPart.java @@ -3,23 +3,15 @@ package nautilus.game.arcade.game.games.christmas; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; -import mineplex.core.common.util.UtilServer; -import net.minecraft.server.v1_6_R3.MobEffect; -import net.minecraft.server.v1_6_R3.MobEffectList; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; import org.bukkit.Color; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftFallingSand; import org.bukkit.entity.Chicken; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.LeatherArmorMeta; @@ -77,7 +69,7 @@ public class SleighPart ent = ent.getPassenger(); if (ent instanceof FallingBlock) - ((CraftFallingSand)ent).getHandle().c = 1; + ((CraftFallingSand)ent).getHandle().b = 1; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java index bb99ae41f..e2c524f41 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossMobs.java @@ -7,11 +7,11 @@ import java.util.Iterator; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilTime; import nautilus.game.arcade.game.games.christmas.parts.Part5; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java index 90e508865..c9d4a0288 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/BossSnowmanPattern.java @@ -11,11 +11,11 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.parts.Part5; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java index 64d472891..a3fc4920b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanBoss.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.IronGolem; @@ -23,7 +23,7 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.recharge.Recharge; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.christmas.Christmas; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; public class SnowmanBoss { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java index f7fc606c4..a8c6f03b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveA.java @@ -9,11 +9,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java index ff4d4538f..c3768ae03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/content/SnowmanWaveB.java @@ -9,11 +9,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import mineplex.core.recharge.Recharge; import nautilus.game.arcade.game.games.christmas.Christmas; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.Effect; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java index f966a68a9..40fcb1637 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part.java @@ -12,7 +12,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.christmas.Christmas; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.Location; import org.bukkit.Material; @@ -20,7 +20,7 @@ import org.bukkit.SkullType; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Skull; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Ageable; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java index 69df6508e..8052bf29e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmas/parts/Part5.java @@ -13,7 +13,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.content.*; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; import org.bukkit.Effect; import org.bukkit.EntityEffect; @@ -22,7 +22,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Player; import org.bukkit.entity.Snowman; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java index 34247d9e8..647ce84d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonriders/DragonData.java @@ -7,7 +7,7 @@ import nautilus.game.arcade.ArcadeManager; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEnderDragon; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEnderDragon; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index d52d786bf..5977719c5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -12,7 +12,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftFallingSand; import org.bukkit.entity.Arrow; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; @@ -311,7 +311,7 @@ public class Gravity extends SoloGame //Dont Disappear if (obj.Ent instanceof FallingBlock) - ((CraftFallingSand)obj.Ent).getHandle().c = 1; + ((CraftFallingSand)obj.Ent).getHandle().b = 1; HashMap blocks = UtilBlock.getInRadius(obj.Ent.getLocation(), 1.2); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java index 9c3503cde..81d3d6567 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java @@ -36,7 +36,7 @@ public class GravityPlayer extends GravityObject @Override public void PlayCollideSound(double power) { - Ent.getWorld().playSound(Ent.getLocation(), Sound.HURT, 0.8f, 0.75f); + Ent.getWorld().playSound(Ent.getLocation(), Sound.HURT_FLESH, 0.8f, 0.75f); } public boolean NearBlock() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java index 95bcd4d53..62dd76d4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/CreatureBase.java @@ -5,11 +5,11 @@ import mineplex.core.common.util.UtilMath; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityTargetEvent; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java index e97c81706..08dac97f1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/creatures/PumpkinKing.java @@ -23,17 +23,17 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.Game; -import net.minecraft.server.v1_6_R3.EntityArrow; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityArrow; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftArrow; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index 0a6bab9c7..8d673bb94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -11,7 +11,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.FireworkEffect.Type; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Arrow; import org.bukkit.entity.Chicken; @@ -75,8 +75,8 @@ import nautilus.game.arcade.game.games.hideseek.forms.Form; import nautilus.game.arcade.game.games.hideseek.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; @SuppressWarnings("deprecation") public class HideSeek extends TeamGame @@ -686,7 +686,7 @@ public class HideSeek extends TeamGame UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Basic Boost") + "!")); //Sound - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); } else if (UtilGear.isMat(player.getItemInHand(), Material.STONE_AXE)) { @@ -696,7 +696,7 @@ public class HideSeek extends TeamGame UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Ultra Boost") + "!")); //Sound - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); } else if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE)) { @@ -707,7 +707,7 @@ public class HideSeek extends TeamGame UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Mega Boost") + "!")); //Sound - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); } else if (UtilGear.isMat(player.getItemInHand(), Material.DIAMOND_AXE)) { @@ -718,7 +718,7 @@ public class HideSeek extends TeamGame UtilPlayer.message(player, F.main("Game", "You used " + F.elem("Hyper Boost") + "!")); //Sound - player.getWorld().playSound(player.getLocation(), Sound.BREATH, 1f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 1f, 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java index fa0c4d2cf..a045edd39 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/BlockForm.java @@ -20,8 +20,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftFallingSand; import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -234,7 +234,7 @@ public class BlockForm extends Form //Ensure Falling doesnt Despawn else { - ((CraftFallingSand)Player.getPassenger()).getHandle().c = 1; + ((CraftFallingSand)Player.getPassenger()).getHandle().b = 1; Player.getPassenger().setTicksLived(1); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java index 0a292a6ce..f5d369153 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/forms/CreatureForm.java @@ -10,7 +10,7 @@ import nautilus.game.arcade.game.games.hideseek.HideSeek; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/ChunkChange.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/ChunkChange.java index 0d93efac2..1c76edcd8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/ChunkChange.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/ChunkChange.java @@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.hungergames; import java.util.ArrayList; -import net.minecraft.server.v1_6_R3.PlayerChunkMap; +import net.minecraft.server.v1_7_R1.PlayerChunkMap; import org.bukkit.Chunk; import org.bukkit.Location; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java index 58d436938..c31f0db95 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hungergames/HungerGames.java @@ -18,7 +18,7 @@ import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Chest; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Firework; import org.bukkit.entity.ItemFrame; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index 5294e2fbc..8427dedcc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -9,7 +9,7 @@ import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Chicken; import org.bukkit.entity.Cow; import org.bukkit.entity.Creature; @@ -45,8 +45,8 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.milkcow.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class MilkCow extends SoloGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index a1722c3f9..d229298db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -13,7 +13,7 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.EnderPearl; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -47,6 +47,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.events.PlayerPrepareTeleportEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.GameTeam.PlayerState; @@ -93,17 +94,10 @@ public class Paintball extends TeamGame } - @EventHandler(priority = EventPriority.HIGH) - public void ColorArmor(GameStateChangeEvent event) + @EventHandler(priority = EventPriority.HIGHEST) + public void ColorArmor(PlayerPrepareTeleportEvent event) { - if (event.GetState() != GameState.Prepare) - return; - - for (Player player : GetPlayers(true)) - { - CleanColorArmor(player); - } - + CleanColorArmor(event.GetPlayer()); } @EventHandler(priority = EventPriority.HIGH) @@ -281,7 +275,7 @@ public class Paintball extends TeamGame player.setGameMode(GameMode.CREATIVE); player.setFlying(true); ((CraftPlayer)player).getHandle().spectating = true; - ((CraftPlayer)player).getHandle().m = false; + ((CraftPlayer)player).getHandle().l = false; player.setVelocity(new Vector(0,1.2,0)); @@ -387,7 +381,7 @@ public class Paintball extends TeamGame player.setGameMode(GameMode.SURVIVAL); player.setFlying(false); ((CraftPlayer)player).getHandle().spectating = false; - ((CraftPlayer)player).getHandle().m = true; + ((CraftPlayer)player).getHandle().l = true; //Items player.getInventory().remove(Material.WATCH); @@ -423,14 +417,16 @@ public class Paintball extends TeamGame if (Manager.GetColor(player) != ChatColor.RED) color = Color.AQUA; - for (ItemStack stack : player.getInventory().getArmorContents()) + for (ItemStack stack : player.getEquipment().getArmorContents()) { + System.out.println("Type:" + stack.getType() + " Meta:" + stack.getItemMeta()); if (!(stack.getItemMeta() instanceof LeatherArmorMeta)) continue; LeatherArmorMeta meta = (LeatherArmorMeta)stack.getItemMeta(); meta.setColor(color); stack.setItemMeta(meta); + System.out.println("Changed leather meta for " + player.getName()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java index f97d5c5fc..d2c082e5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitRifle.java @@ -65,5 +65,7 @@ public class KitRifle extends Kit metaBoots.setColor(Color.WHITE); boots.setItemMeta(metaBoots); player.getInventory().setBoots(boots); + + System.out.println("Game kit items to " + player.getName()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java index ff6e0bb33..06505cedf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/Runner.java @@ -9,7 +9,7 @@ import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.FallingBlock; @@ -32,7 +32,7 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.runner.kits.*; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_6_R3.EntityArrow; +import net.minecraft.server.v1_7_R1.EntityArrow; public class Runner extends SoloGame implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java index 3976535e9..4798d9fd8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/SheepGame.java @@ -66,7 +66,7 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.sheep.kits.*; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_6_R3.Item; +import net.minecraft.server.v1_7_R1.Item; public class SheepGame extends TeamGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java index 121d21f42..c24e77300 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/SuperSmash.java @@ -65,7 +65,7 @@ public class SuperSmash extends SoloGame new KitSkeletalHorse(manager), new KitPig(manager), new KitSkySquid(manager), - new KitWitherSkeleton(manager), + new KitWitherSkeleton(manager), new KitMagmaCube(manager), }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java index ba5d0d69f..d45035eec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/Snake.java @@ -11,7 +11,7 @@ import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Cow; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; @@ -47,8 +47,8 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.snake.kits.*; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class Snake extends SoloGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java index d3b665053..8e395a34e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/Spleef.java @@ -4,7 +4,7 @@ import java.lang.reflect.Field; import org.bukkit.Effect; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -25,7 +25,7 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.spleef.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; -import net.minecraft.server.v1_6_R3.EntityArrow; +import net.minecraft.server.v1_7_R1.EntityArrow; public class Spleef extends SoloGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java index 62ed411b3..a49d57a74 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/stacker/Stacker.java @@ -194,7 +194,7 @@ public class Stacker extends SoloGame implements IThrown UtilPlayer.message(target, F.main("Game", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); //Effect - data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT_FLESH, 1f, 1f); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 3395f5490..be957889d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -12,7 +12,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftArrow; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftArrow; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; @@ -45,8 +45,8 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.games.turfforts.kits.*; import nautilus.game.arcade.kit.Kit; -import net.minecraft.server.v1_6_R3.EntityArrow; -import net.minecraft.server.v1_6_R3.Item; +import net.minecraft.server.v1_7_R1.EntityArrow; +import net.minecraft.server.v1_7_R1.Item; public class TurfForts extends TeamGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 6a863b7a6..98e0126aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -17,8 +17,8 @@ import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; -import org.bukkit.craftbukkit.v1_6_R3.CraftServer; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.CraftServer; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java index 9c4543875..05e2d7545 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/ZombieSurvival.java @@ -6,7 +6,7 @@ import java.util.Iterator; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; @@ -32,8 +32,8 @@ import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.zombiesurvival.kits.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class ZombieSurvival extends SoloGame { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java index d242c48d9..865a70594 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkApple.java @@ -22,7 +22,7 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_6_R3.Item; +import net.minecraft.server.v1_7_R1.Item; public class PerkApple extends Perk implements IThrown { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBackstab.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBackstab.java index 2c40ccd95..7b282ab83 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBackstab.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBackstab.java @@ -58,7 +58,7 @@ public class PerkBackstab extends Perk event.AddMod(damager.getName(), GetName(), 2, true); //Effect - damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT, 1f, 2f); + damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f); return; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java index da442bfc2..cf746ed05 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSkeletons.java @@ -7,8 +7,8 @@ import java.util.Iterator; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftSkeleton; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; @@ -28,8 +28,8 @@ import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class PerkSkeletons extends Perk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java index 89099802c..450f694d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkTNTArrow.java @@ -5,7 +5,7 @@ import java.util.HashSet; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftTNTPrimed; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftTNTPrimed; import org.bukkit.entity.Arrow; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java index 938fe0510..cde1caf53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolf.java @@ -8,8 +8,8 @@ import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftWolf; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; @@ -35,8 +35,8 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class PerkWolf extends Perk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java index 6f2dcad1e..fccb28d43 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPack.java @@ -12,9 +12,9 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftWolf; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Wolf; @@ -41,8 +41,8 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class PerkWolfPack extends Perk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java index b82134bee..33a131b75 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWolfPet.java @@ -10,9 +10,9 @@ import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftWolf; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftWolf; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -38,8 +38,8 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.kit.Perk; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class PerkWolfPet extends Perk { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java index 98ffafda4..f2d188e7d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLobbyManager.java @@ -48,8 +48,8 @@ import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilText.TextAlign; import mineplex.core.donation.Donor; import mineplex.core.packethandler.IPacketRunnable; -import mineplex.core.packethandler.PacketArrayList; import mineplex.core.packethandler.PacketHandler; +import mineplex.core.packethandler.PacketVerifier; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -60,11 +60,12 @@ import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; -import net.minecraft.server.v1_6_R3.DataWatcher; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet24MobSpawn; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; -import net.minecraft.server.v1_6_R3.WatchableObject; +import net.minecraft.server.v1_7_R1.DataWatcher; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R1.QueuedPacket; +import net.minecraft.server.v1_7_R1.WatchableObject; public class GameLobbyManager implements IPacketRunnable, Listener { @@ -96,9 +97,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener private NautHashMap _gemMap = new NautHashMap(); private NautHashMap _kitMap = new NautHashMap(); - private Field _packet40Metadata; - private Field _packet24MobSpawn; - private int _oldPlayerCount = 0; public GameLobbyManager(ArcadeManager manager, PacketHandler packetHandler) @@ -118,23 +116,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener _kitDisplay = new Location(world, -17, 101, 0); _teamDisplay = new Location(world, 18, 101, 0); - try - { - _packet40Metadata = Packet40EntityMetadata.class.getDeclaredField("b"); - _packet24MobSpawn = Packet24MobSpawn.class.getDeclaredField("t"); - } - catch (NoSuchFieldException e) - { - e.printStackTrace(); - } - catch (SecurityException e) - { - e.printStackTrace(); - } - - _packet40Metadata.setAccessible(true); - _packet24MobSpawn.setAccessible(true); - Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); } @@ -1002,15 +983,15 @@ public class GameLobbyManager implements IPacketRunnable, Listener @SuppressWarnings("unchecked") @Override - public boolean run(Packet packet, Player owner, PacketArrayList packetList) + public boolean run(Packet packet, Player owner, PacketVerifier packetList) { int entityId = -1; - if (packet instanceof Packet40EntityMetadata) + if (packet instanceof PacketPlayOutEntityMetadata) { - entityId = ((Packet40EntityMetadata)packet).a; + entityId = ((PacketPlayOutEntityMetadata)packet).a; } - else if (packet instanceof Packet24MobSpawn) + else if (packet instanceof PacketPlayOutSpawnEntityLiving) { //entityId = ((Packet24MobSpawn)packet).a; } @@ -1033,11 +1014,11 @@ public class GameLobbyManager implements IPacketRunnable, Listener { try { - if (packet instanceof Packet40EntityMetadata) + if (packet instanceof PacketPlayOutEntityMetadata) { List watchables = new ArrayList(); - for (WatchableObject watchableObject : (List)_packet40Metadata.get(packet)) + for (WatchableObject watchableObject : (List)((PacketPlayOutEntityMetadata) packet).b) { WatchableObject newWatch = new WatchableObject(watchableObject.c(), watchableObject.a(), watchableObject.b()); @@ -1049,17 +1030,17 @@ public class GameLobbyManager implements IPacketRunnable, Listener watchables.add(newWatch); } - Packet40EntityMetadata newPacket = new Packet40EntityMetadata(); + PacketPlayOutEntityMetadata newPacket = new PacketPlayOutEntityMetadata(); newPacket.a = entityId; - _packet40Metadata.set(newPacket, watchables); + newPacket.b = watchables; - packetList.forceAdd(newPacket); + packetList.forceProcess(newPacket); return false; } - else if (packet instanceof Packet24MobSpawn) + else if (packet instanceof PacketPlayOutSpawnEntityLiving) { - DataWatcher watcher = (DataWatcher)_packet24MobSpawn.get((Packet24MobSpawn)packet); + DataWatcher watcher = ((PacketPlayOutSpawnEntityLiving)packet).l; watcher.watch(10, customName); watcher.watch(11, Byte.valueOf((byte)1)); } @@ -1068,10 +1049,6 @@ public class GameLobbyManager implements IPacketRunnable, Listener { e.printStackTrace(); } - catch (IllegalAccessException e) - { - e.printStackTrace(); - } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 6ec9cf955..6791d67f9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -470,7 +470,7 @@ public class GameManager implements Listener return true; } - @EventHandler + @EventHandler(priority = EventPriority.LOWEST) public void PlayerPrepare(GameStateChangeEvent event) { final Game game = event.GetGame(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index b625c8267..97b54b2df 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -21,13 +21,13 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.KitPackage; -import net.minecraft.server.v1_6_R3.Packet40EntityMetadata; +import net.minecraft.server.v1_7_R1.PacketPlayOutEntityMetadata; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -301,7 +301,7 @@ public class GamePlayerManager implements Listener if (player.isOnline()) { Manager.GetGame().SetKit(player, kit, true); - ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new Packet40EntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true)); + ((CraftPlayer)player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entity.getEntityId(), ((CraftEntity)entity).getHandle().getDataWatcher(), true)); } } }, null, new KitPackage(Manager.GetGame().GetName(), kit), CurrencyType.Gems, player)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java index 717960bea..cb6567e60 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/world/WorldData.java @@ -17,7 +17,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.WorldUtil; import nautilus.game.arcade.game.Game; import nautilus.minecraft.core.utils.ZipUtil; -import net.minecraft.server.v1_6_R3.ChunkPreLoadEvent; +import net.minecraft.server.v1_7_R1.ChunkPreLoadEvent; import org.bukkit.Difficulty; import org.bukkit.Location; diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java index c721fb470..0f2f1b024 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/Arena.java @@ -6,9 +6,9 @@ import java.util.List; import java.util.Set; import mineplex.core.common.util.WorldUtil; -import net.minecraft.server.v1_6_R3.ChunkCoordinates; +import net.minecraft.server.v1_7_R1.ChunkCoordinates; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.block.Block; diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java index a94025235..0fb275b89 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/arena/ArenaManager.java @@ -15,7 +15,7 @@ import mineplex.core.common.util.Callback; import mineplex.core.common.util.FileUtil; import mineplex.core.common.util.MapUtil; import nautilus.minecraft.core.utils.ZipUtil; -import net.minecraft.server.v1_6_R3.ChunkPreLoadEvent; +import net.minecraft.server.v1_7_R1.ChunkPreLoadEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java index df678cab7..4dcc155a7 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/GameEngine.java @@ -5,7 +5,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; -import org.bukkit.craftbukkit.v1_6_R3.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_7_R1.inventory.CraftItemStack; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Projectile; @@ -88,10 +88,10 @@ import nautilus.game.core.player.IGamePlayer; import nautilus.game.core.scoreboard.IScoreHandler; import nautilus.minecraft.core.event.AfkEvent; import nautilus.minecraft.core.player.AfkMonitor; -import net.minecraft.server.v1_6_R3.Item; -import net.minecraft.server.v1_6_R3.NBTTagCompound; -import net.minecraft.server.v1_6_R3.NBTTagList; -import net.minecraft.server.v1_6_R3.NBTTagString; +import net.minecraft.server.v1_7_R1.Item; +import net.minecraft.server.v1_7_R1.NBTTagCompound; +import net.minecraft.server.v1_7_R1.NBTTagList; +import net.minecraft.server.v1_7_R1.NBTTagString; public abstract class GameEngine, ScoreHandlerType extends IScoreHandler, ArenaType extends IArena, PlayerType extends IGamePlayer> implements IGameEngine, Listener, IRelation { diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java index a5d174479..6511d8ddb 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/engine/TeamGameEngine.java @@ -5,7 +5,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -51,8 +51,8 @@ import nautilus.game.core.game.ITeamGame; import nautilus.game.core.player.ITeamGamePlayer; import nautilus.game.core.scoreboard.ITeamScoreHandler; import nautilus.minecraft.core.utils.GenericRunnable; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet201PlayerInfo; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.Packet201PlayerInfo; public abstract class TeamGameEngine, ScoreHandlerType extends ITeamScoreHandler, ArenaType extends ITeamArena, PlayerTeamType extends ITeam, PlayerType extends ITeamGamePlayer> extends GameEngine implements ITeamGameEngine { diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java index 60cfdb6ac..53d404f66 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/player/GamePlayer.java @@ -5,7 +5,7 @@ import mineplex.minecraft.game.classcombat.Class.ClientClass; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.inventory.PlayerInventory; import org.bukkit.plugin.java.JavaPlugin; diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java index a10526156..f25f32935 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/LineTracker.java @@ -1,7 +1,7 @@ package nautilus.game.core.scoreboard; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet201PlayerInfo; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Packet201PlayerInfo; public class LineTracker { diff --git a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java index aaec518cf..48f3c2235 100644 --- a/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java +++ b/Plugins/Nautilus.Game.Core/src/nautilus/game/core/scoreboard/TabScoreboard.java @@ -1,7 +1,7 @@ package nautilus.game.core.scoreboard; import org.bukkit.ChatColor; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -16,9 +16,9 @@ import nautilus.game.core.engine.ITeam; import nautilus.game.core.game.ITeamGame; import nautilus.game.core.player.ITeamGamePlayer; import nautilus.minecraft.core.utils.TimeStuff; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet201PlayerInfo; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.Packet201PlayerInfo; public class TabScoreboard, PlayerType extends ITeamGamePlayer, TeamType extends ITeam> implements IPacketRunnable { diff --git a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java index 032e7b090..47fe09a91 100644 --- a/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java +++ b/Plugins/Nautilus.Game.Dominate/src/nautilus/game/dominate/engine/PowerUp.java @@ -1,13 +1,13 @@ package nautilus.game.dominate.engine; import mineplex.core.common.util.MapUtil; -import net.minecraft.server.v1_6_R3.EntityItem; +import net.minecraft.server.v1_7_R1.EntityItem; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java index 75bf40ab0..17bb5b3ac 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/MineKart.java @@ -35,13 +35,13 @@ import nautilus.game.minekart.shop.KartShop; import nautilus.game.minekart.track.TrackManager; import nautilus.game.minekart.track.TrackProcessor; import nautilus.minecraft.core.INautilusPlugin; -import net.minecraft.server.v1_6_R3.EntityPlayer; +import net.minecraft.server.v1_7_R1.EntityPlayer; import org.apache.commons.io.FileDeleteStrategy; import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Server; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java index a7e430c98..a22a58db9 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/gp/GPResult.java @@ -18,13 +18,13 @@ import mineplex.core.fakeEntity.FakeEntity; import mineplex.core.fakeEntity.FakePlayer; import nautilus.game.minekart.kart.Kart; import nautilus.minecraft.core.utils.ZipUtil; -import net.minecraft.server.v1_6_R3.EntityPlayer; +import net.minecraft.server.v1_7_R1.EntityPlayer; import org.apache.commons.lang.math.RandomUtils; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.WorldCreator; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; public class GPResult diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java index 4a772ca04..30305c9ec 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/item/control/Movement.java @@ -4,8 +4,8 @@ import java.lang.reflect.Field; import java.util.List; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.CraftWorld; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftLivingEntity; +import org.bukkit.craftbukkit.v1_7_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftLivingEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.util.Vector; @@ -18,9 +18,9 @@ import nautilus.game.minekart.item.KartItemEntity; import nautilus.game.minekart.kart.Kart; import nautilus.game.minekart.kart.KartUtil; import nautilus.game.minekart.kart.condition.ConditionType; -import net.minecraft.server.v1_6_R3.EntityInsentient; -import net.minecraft.server.v1_6_R3.EntityLiving; -import net.minecraft.server.v1_6_R3.PathfinderGoalSelector; +import net.minecraft.server.v1_7_R1.EntityInsentient; +import net.minecraft.server.v1_7_R1.EntityLiving; +import net.minecraft.server.v1_7_R1.PathfinderGoalSelector; public class Movement { diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java index b3fe461f9..5fcb7cb1f 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/kart/KartManager.java @@ -13,15 +13,15 @@ import nautilus.game.minekart.kart.control.*; import nautilus.game.minekart.kart.crash.Crash; import nautilus.game.minekart.track.Track.TrackState; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.MathHelper; -import net.minecraft.server.v1_6_R3.Packet; -import net.minecraft.server.v1_6_R3.Packet34EntityTeleport; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.MathHelper; +import net.minecraft.server.v1_7_R1.Packet; +import net.minecraft.server.v1_7_R1.Packet34EntityTeleport; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java index e2a033ef7..dfda3b253 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/menu/KartPage.java @@ -16,7 +16,7 @@ import nautilus.game.minekart.gp.GPSet; import nautilus.game.minekart.item.KartItemType; import nautilus.game.minekart.kart.KartType; import nautilus.game.minekart.shop.KartItem; -import net.minecraft.server.v1_6_R3.NBTTagList; +import net.minecraft.server.v1_7_R1.NBTTagList; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java index dd1e774f0..126ee5cce 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/shop/page/KartPage.java @@ -18,7 +18,7 @@ import nautilus.game.minekart.kart.KartType; import nautilus.game.minekart.shop.KartItem; import nautilus.game.minekart.shop.KartItemButton; import nautilus.game.minekart.shop.KartShop; -import net.minecraft.server.v1_6_R3.NBTTagList; +import net.minecraft.server.v1_7_R1.NBTTagList; import org.bukkit.ChatColor; import org.bukkit.Material; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java index 02b8e1b99..bb606e852 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/Track.java @@ -23,7 +23,7 @@ import nautilus.game.minekart.gp.GPBattle; import nautilus.game.minekart.kart.Kart; import nautilus.game.minekart.track.ents.*; import nautilus.minecraft.core.utils.ZipUtil; -import net.minecraft.server.v1_6_R3.ChunkPreLoadEvent; +import net.minecraft.server.v1_7_R1.ChunkPreLoadEvent; import org.bukkit.Location; import org.bukkit.Sound; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java index c02260b0e..5a7d67516 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackEntity.java @@ -3,11 +3,11 @@ package nautilus.game.minekart.track; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilTime; import nautilus.game.minekart.kart.Kart; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; import org.bukkit.Location; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java index f7b3e0ace..5144dcf51 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/TrackManager.java @@ -17,16 +17,16 @@ import nautilus.game.minekart.gp.GPBattle; import nautilus.game.minekart.kart.Kart; import nautilus.game.minekart.kart.KartState; import nautilus.game.minekart.track.Track.TrackState; -import net.minecraft.server.v1_6_R3.ChunkPreLoadEvent; -import net.minecraft.server.v1_6_R3.EntityPlayer; -import net.minecraft.server.v1_6_R3.Packet; +import net.minecraft.server.v1_7_R1.ChunkPreLoadEvent; +import net.minecraft.server.v1_7_R1.EntityPlayer; +import net.minecraft.server.v1_7_R1.Packet; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockIgniteEvent; diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java index ff5953994..ca0cf4030 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Cow.java @@ -2,7 +2,7 @@ package nautilus.game.minekart.track.ents; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.util.Vector; @@ -17,8 +17,8 @@ import nautilus.game.minekart.kart.Kart; import nautilus.game.minekart.kart.crash.Crash_Explode; import nautilus.game.minekart.track.Track; import nautilus.game.minekart.track.TrackEntity; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class Cow extends TrackEntity { diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java index 0f5a571a7..a0febbded 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Sheepile.java @@ -5,7 +5,7 @@ import java.util.HashSet; import org.bukkit.DyeColor; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.entity.Sheep; @@ -20,7 +20,7 @@ import nautilus.game.minekart.kart.Kart; import nautilus.game.minekart.kart.crash.Crash_Explode; import nautilus.game.minekart.track.Track; import nautilus.game.minekart.track.TrackEntity; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; public class Sheepile extends TrackEntity { diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Spiderling.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Spiderling.java index f63cc1c1a..21d4a0465 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Spiderling.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Spiderling.java @@ -2,7 +2,7 @@ package nautilus.game.minekart.track.ents; import org.bukkit.Location; import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; import org.bukkit.util.Vector; @@ -16,8 +16,8 @@ import nautilus.game.minekart.kart.Kart; import nautilus.game.minekart.kart.crash.Crash_Explode; import nautilus.game.minekart.track.Track; import nautilus.game.minekart.track.TrackEntity; -import net.minecraft.server.v1_6_R3.EntityCreature; -import net.minecraft.server.v1_6_R3.Navigation; +import net.minecraft.server.v1_7_R1.EntityCreature; +import net.minecraft.server.v1_7_R1.Navigation; public class Spiderling extends TrackEntity { diff --git a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java index b844366f8..a81334842 100644 --- a/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java +++ b/Plugins/Nautilus.Game.MineKart/src/nautilus/game/minekart/track/ents/Train.java @@ -6,7 +6,7 @@ import org.bukkit.Location; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; +import org.bukkit.craftbukkit.v1_7_R1.entity.CraftCreature; import org.bukkit.entity.Creature; import org.bukkit.entity.EntityType; @@ -18,7 +18,7 @@ import nautilus.game.minekart.kart.KartState; import nautilus.game.minekart.kart.crash.Crash_Explode; import nautilus.game.minekart.track.Track; import nautilus.game.minekart.track.TrackEntity; -import net.minecraft.server.v1_6_R3.EntityCreature; +import net.minecraft.server.v1_7_R1.EntityCreature; public class Train extends TrackEntity {