diff --git a/src/main/java/net/minecraft/server/AABBPool.java b/src/main/java/net/minecraft/server/AABBPool.java index 0815fbd1e1..ed6ffd3684 100644 --- a/src/main/java/net/minecraft/server/AABBPool.java +++ b/src/main/java/net/minecraft/server/AABBPool.java @@ -39,7 +39,7 @@ public class AABBPool { this.largestSize = this.d; } - // CraftBukkit start - intelligent cache + // CraftBukkit start - Intelligent cache if ((this.resizeTime++ & 0xff) == 0) { int newSize = this.pool.size() - (this.pool.size() >> 3); // newSize will be 87.5%, but if we were not in that range, we clear some of the cache diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java index ac7bb51a39..c39a8ce692 100644 --- a/src/main/java/net/minecraft/server/BlockDropper.java +++ b/src/main/java/net/minecraft/server/BlockDropper.java @@ -3,7 +3,6 @@ package net.minecraft.server; // CraftBukkit start import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.event.inventory.InventoryMoveItemEvent; -import org.bukkit.inventory.Inventory; // CraftBukkit end public class BlockDropper extends BlockDispenser { @@ -38,10 +37,10 @@ public class BlockDropper extends BlockDispenser { ItemStack itemstack1; if (iinventory != null) { - // CraftBukkit start - fire event when pushing items into other inventories + // CraftBukkit start - Fire event when pushing items into other inventories CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().a(1)); - Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; + org.bukkit.inventory.Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; InventoryMoveItemEvent event = new InventoryMoveItemEvent(tileentitydispenser.getOwner().getInventory(), oitemstack.clone(), destinationInventory, true); world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index aa818d615d..73a6e83b3b 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -134,7 +134,7 @@ public class BlockFire extends Block { k2 = 15; } - // CraftBukkit start - call to stop spread of fire + // CraftBukkit start - Call to stop spread of fire if (world.getTypeId(i1, k1, j1) != Block.FIRE.id) { if (CraftEventFactory.callBlockIgniteEvent(world, i1, k1, j1, i, j, k).isCancelled()) { continue; @@ -261,7 +261,7 @@ public class BlockFire extends Block { // CraftBukkit start private void fireExtinguished(World world, int x, int y, int z) { - if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) { + if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled()) { world.setAir(x, y, z); } } diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index 2b5d1f3932..c95e922dba 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -100,7 +100,7 @@ public class BlockFlowing extends BlockFluids { } if (this.o(world, i, j - 1, k)) { - // CraftBukkit start - send "down" to the server + // CraftBukkit start - Send "down" to the server BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN); if (server != null) { server.getPluginManager().callEvent(event); @@ -132,7 +132,7 @@ public class BlockFlowing extends BlockFluids { return; } - // CraftBukkit start - all four cardinal directions. Do not change the order! + // CraftBukkit start - All four cardinal directions. Do not change the order! BlockFace[] faces = new BlockFace[] { BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH, BlockFace.SOUTH }; int index = 0; diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java index 614a3d16a4..27f0dab958 100644 --- a/src/main/java/net/minecraft/server/BlockMobSpawner.java +++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java @@ -22,7 +22,7 @@ public class BlockMobSpawner extends BlockContainer { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { super.dropNaturally(world, i, j, k, l, f, i1); - /* CraftBukkit start - delegate to getExpDrop + /* CraftBukkit start - Delegate to getExpDrop int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15); this.j(world, i, j, k, j1);*/ diff --git a/src/main/java/net/minecraft/server/BlockOre.java b/src/main/java/net/minecraft/server/BlockOre.java index fb1a142714..2f406ba6a0 100644 --- a/src/main/java/net/minecraft/server/BlockOre.java +++ b/src/main/java/net/minecraft/server/BlockOre.java @@ -33,7 +33,7 @@ public class BlockOre extends Block { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { super.dropNaturally(world, i, j, k, l, f, i1); - /* CraftBukkit start - delegated getExpDrop + /* CraftBukkit start - Delegated to getExpDrop if (this.getDropType(l, world.random, i1) != this.id) { int j1 = 0; diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java index 6f7788c4e2..74df20a02a 100644 --- a/src/main/java/net/minecraft/server/BlockPumpkin.java +++ b/src/main/java/net/minecraft/server/BlockPumpkin.java @@ -21,7 +21,7 @@ public class BlockPumpkin extends BlockDirectional { super.onPlace(world, i, j, k); if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) { if (!world.isStatic) { - // CraftBukkit start - use BlockStateListPopulator + // CraftBukkit start - Use BlockStateListPopulator BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); blockList.setTypeId(i, j, k, 0); @@ -45,7 +45,7 @@ public class BlockPumpkin extends BlockDirectional { boolean flag1 = world.getTypeId(i, j - 1, k - 1) == Block.IRON_BLOCK.id && world.getTypeId(i, j - 1, k + 1) == Block.IRON_BLOCK.id; if (flag || flag1) { - // CraftBukkit start - use BlockStateListPopulator + // CraftBukkit start - Use BlockStateListPopulator BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); blockList.setTypeId(i, j, k, 0); diff --git a/src/main/java/net/minecraft/server/BlockRedstoneOre.java b/src/main/java/net/minecraft/server/BlockRedstoneOre.java index 4f059d2425..73eb990c42 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneOre.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneOre.java @@ -77,7 +77,7 @@ public class BlockRedstoneOre extends Block { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { super.dropNaturally(world, i, j, k, l, f, i1); - /* CraftBukkit start - delegate to getExpDrop + /* CraftBukkit start - Delegated to getExpDrop if (this.getDropType(l, world.random, i1) != this.id) { int j1 = 1 + world.random.nextInt(5); diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 56938cdcd2..3b00939f5d 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -6,6 +6,7 @@ import java.util.Random; import org.bukkit.Location; import org.bukkit.TreeType; import org.bukkit.craftbukkit.util.StructureGrowDelegate; +import org.bukkit.entity.Player; import org.bukkit.event.world.StructureGrowEvent; // CraftBukkit end @@ -32,7 +33,7 @@ public class BlockSapling extends BlockFlower { } // CraftBukkit - added bonemeal, player and itemstack - public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) { + public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) { int l = world.getData(i, j, k); if ((l & 8) == 0) { @@ -42,14 +43,14 @@ public class BlockSapling extends BlockFlower { } } - // CraftBukkit - added bonemeal, player and itemstack - public void d(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) { + // CraftBukkit - Added bonemeal, player and itemstack + public void d(World world, int i, int j, int k, Random random, boolean bonemeal, Player player, ItemStack itemstack) { int l = world.getData(i, j, k) & 3; Object object = null; int i1 = 0; int j1 = 0; boolean flag = false; - // CraftBukkit start - records tree generation and calls StructureGrowEvent + // CraftBukkit start - Records tree generation and calls StructureGrowEvent StructureGrowDelegate delegate = new StructureGrowDelegate(world); TreeType treeType = null; TreeGenerator gen = null; diff --git a/src/main/java/net/minecraft/server/BlockSkull.java b/src/main/java/net/minecraft/server/BlockSkull.java index 933f49aeca..7d659efcd4 100644 --- a/src/main/java/net/minecraft/server/BlockSkull.java +++ b/src/main/java/net/minecraft/server/BlockSkull.java @@ -77,7 +77,7 @@ public class BlockSkull extends BlockContainer { return i; } - // CraftBukkit start - special case dropping so we can get info from the tile entity + // CraftBukkit start - Special case dropping so we can get info from the tile entity public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { if (world.random.nextFloat() < f) { ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k)); @@ -104,7 +104,7 @@ public class BlockSkull extends BlockContainer { public void remove(World world, int i, int j, int k, int l, int i1) { if (!world.isStatic) { - /* CraftBukkit start - drop item in code above, not here + /* CraftBukkit start - Drop item in code above, not here if ((i1 & 8) == 0) { ItemStack itemstack = new ItemStack(Item.SKULL.id, 1, this.getDropData(world, i, j, k)); TileEntitySkull tileentityskull = (TileEntitySkull) world.getTileEntity(i, j, k); @@ -136,7 +136,7 @@ public class BlockSkull extends BlockContainer { for (i1 = -2; i1 <= 0; ++i1) { if (world.getTypeId(i, j - 1, k + i1) == l && world.getTypeId(i, j - 1, k + i1 + 1) == l && world.getTypeId(i, j - 2, k + i1 + 1) == l && world.getTypeId(i, j - 1, k + i1 + 2) == l && this.d(world, i, j, k + i1, 1) && this.d(world, i, j, k + i1 + 1, 1) && this.d(world, i, j, k + i1 + 2, 1)) { - // CraftBukkit start - use BlockStateListPopulator + // CraftBukkit start - Use BlockStateListPopulator BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); world.setData(i, j, k + i1, 8, 2); @@ -173,7 +173,7 @@ public class BlockSkull extends BlockContainer { for (i1 = -2; i1 <= 0; ++i1) { if (world.getTypeId(i + i1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 1, k) == l && world.getTypeId(i + i1 + 1, j - 2, k) == l && world.getTypeId(i + i1 + 2, j - 1, k) == l && this.d(world, i + i1, j, k, 1) && this.d(world, i + i1 + 1, j, k, 1) && this.d(world, i + i1 + 2, j, k, 1)) { - // CraftBukkit start - use BlockStateListPopulator + // CraftBukkit start - Use BlockStateListPopulator BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); world.setData(i + i1, j, k, 8, 2); diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java index 8da8e11279..d5561b45c1 100644 --- a/src/main/java/net/minecraft/server/BlockSoil.java +++ b/src/main/java/net/minecraft/server/BlockSoil.java @@ -55,7 +55,7 @@ public class BlockSoil extends Block { return; } - // CraftBukkit start - interact soil + // CraftBukkit start - Interact soil org.bukkit.event.Cancellable cancellable; if (entity instanceof EntityHuman) { cancellable = CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null); diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java index 14fbb0fddb..ca051d42d7 100644 --- a/src/main/java/net/minecraft/server/BlockStationary.java +++ b/src/main/java/net/minecraft/server/BlockStationary.java @@ -39,7 +39,7 @@ public class BlockStationary extends BlockFluids { int i1; int j1; - // CraftBukkit start - prevent lava putting something on fire, remember igniter block coords + // CraftBukkit start - Prevent lava putting something on fire, remember igniter block coords int x = i; int y = j; int z = k; @@ -52,7 +52,7 @@ public class BlockStationary extends BlockFluids { j1 = world.getTypeId(i, j, k); if (j1 == 0) { if (this.m(world, i - 1, j, k) || this.m(world, i + 1, j, k) || this.m(world, i, j, k - 1) || this.m(world, i, j, k + 1) || this.m(world, i, j - 1, k) || this.m(world, i, j + 1, k)) { - // CraftBukkit start - prevent lava putting something on fire + // CraftBukkit start - Prevent lava putting something on fire if (world.getTypeId(i, j, k) != Block.FIRE.id) { if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, x, y, z).isCancelled()) { continue; @@ -76,7 +76,7 @@ public class BlockStationary extends BlockFluids { i = i1 + random.nextInt(3) - 1; k = j1 + random.nextInt(3) - 1; if (world.isEmpty(i, j + 1, k) && this.m(world, i, j, k)) { - // CraftBukkit start - prevent lava putting something on fire + // CraftBukkit start - Prevent lava putting something on fire if (world.getTypeId(i, j + 1, k) != Block.FIRE.id) { if (CraftEventFactory.callBlockIgniteEvent(world, i, j + 1, k, x, y, z).isCancelled()) { continue; diff --git a/src/main/java/net/minecraft/server/BlockVine.java b/src/main/java/net/minecraft/server/BlockVine.java index 6dc99f6673..87da4b421d 100644 --- a/src/main/java/net/minecraft/server/BlockVine.java +++ b/src/main/java/net/minecraft/server/BlockVine.java @@ -203,7 +203,7 @@ public class BlockVine extends Block { } if (l1 > 0) { - // CraftBukkit start - fire BlockSpreadEvent + // CraftBukkit start - Call BlockSpreadEvent org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k); CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1); @@ -227,7 +227,7 @@ public class BlockVine extends Block { i2 = k1 + 1 & 3; j2 = k1 + 3 & 3; - // CraftBukkit start - fire BlockSpreadEvent + // CraftBukkit start - Call BlockSpreadEvent org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]); if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) { @@ -250,7 +250,7 @@ public class BlockVine extends Block { if (l1 == 0) { i2 = world.random.nextInt(16) & i1; if (i2 > 0) { - // CraftBukkit start - fire BlockSpreadEvent + // CraftBukkit start - Call BlockSpreadEvent org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k); org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j - 1, k); CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index ce5c73b7ac..7f1c15560f 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -8,10 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Random; -// CraftBukkit start -import org.bukkit.Bukkit; -import org.bukkit.Location; -// CraftBukkit end +import org.bukkit.Bukkit; // CraftBukkit public class Chunk { @@ -430,7 +427,7 @@ public class Chunk { } if (Block.byId[l] instanceof IContainer) { - // CraftBukkit start - don't create tile entity if placement failed + // CraftBukkit start - Don't create tile entity if placement failed if (this.getTypeId(i, j, k) != l) { return false; } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index d5887a987f..8b280ab159 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -11,7 +11,6 @@ import java.util.Set; import java.util.Random; import org.bukkit.Server; -import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; import org.bukkit.craftbukkit.util.LongHash; import org.bukkit.craftbukkit.util.LongHashSet; import org.bukkit.craftbukkit.util.LongObjectHashMap; @@ -80,7 +79,7 @@ public class ChunkProviderServer implements IChunkProvider { } } - // 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); } @@ -97,7 +96,7 @@ public class ChunkProviderServer implements IChunkProvider { // 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); + org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.queueChunkLoad(this.world, loader, this, i, j, runnable); return null; } // CraftBukkit end @@ -115,7 +114,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); } @@ -208,7 +207,7 @@ public class ChunkProviderServer implements IChunkProvider { this.e.a(this.world, chunk); } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception ioexception.printStackTrace(); - // CraftBukkit start - remove extra exception + // CraftBukkit start - Remove extra exception } // } catch (ExceptionWorldConflict exceptionworldconflict) { // exceptionworldconflict.printStackTrace(); diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 8f37333a2b..cc30a041b8 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -40,7 +40,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { } // CraftBukkit end - // CraftBukkit start - add async variant, provide compatibility + // CraftBukkit start - Add async variant, provide compatibility public Chunk a(World world, int i, int j) { Object[] data = this.loadChunk(world, i, j); if (data != null) { @@ -319,7 +319,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { chunk.a(nbttagcompound.getByteArray("Biomes")); } - // CraftBukkit start - end this method here and split off entity loading to another method + // CraftBukkit start - End this method here and split off entity loading to another method return chunk; } diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java index 90e0636dc0..38f3038d76 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -115,7 +115,7 @@ public class ChunkSection { } public void recalcBlockCounts() { - // CraftBukkit start - optimize for speed + // CraftBukkit start - Optimize for speed byte[] blkIds = this.blockIds; int cntNonEmpty = 0; int cntTicking = 0; @@ -223,7 +223,7 @@ public class ChunkSection { } public void a(NibbleArray nibblearray) { - // CraftBukkit start - don't hang on to an empty nibble array + // CraftBukkit start - Don't hang on to an empty nibble array boolean empty = true; for (int i = 0; i < nibblearray.a.length; i++) { if (nibblearray.a[i] != 0) { diff --git a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java index 86bb210763..533842c624 100644 --- a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java +++ b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java @@ -14,7 +14,7 @@ class ConsoleLogFormatter extends Formatter { private SimpleDateFormat b; final ConsoleLogManager a; - // CraftBukkit start - add color stripping + // CraftBukkit start - Add color stripping private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); private boolean strip = false; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java index 96f281012d..a1d930cbb4 100644 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -189,7 +189,7 @@ public abstract class Container { } if (j == 1) { - // CraftBukkit start - store a reference + // CraftBukkit start - Store a reference ItemStack itemstack4 = playerinventory.getCarried(); if (itemstack4.count > 0) { entityhuman.drop(itemstack4.a(1)); diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java index c0d1128d59..21cf62758d 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java @@ -3,11 +3,7 @@ package net.minecraft.server; import java.util.Iterator; import java.util.Map; -// CraftBukkit start -import org.bukkit.craftbukkit.inventory.CraftInventory; -import org.bukkit.craftbukkit.inventory.CraftInventoryAnvil; -import org.bukkit.craftbukkit.inventory.CraftInventoryView; -// CraftBukkit end +import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit public class ContainerAnvil extends Container { @@ -380,7 +376,7 @@ public class ContainerAnvil extends Container { return bukkitEntity; } - CraftInventory inventory = new CraftInventoryAnvil(this.g); + org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryAnvil(this.g); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); return bukkitEntity; } diff --git a/src/main/java/net/minecraft/server/ContainerBeacon.java b/src/main/java/net/minecraft/server/ContainerBeacon.java index 814327cf10..04ccfc1d51 100644 --- a/src/main/java/net/minecraft/server/ContainerBeacon.java +++ b/src/main/java/net/minecraft/server/ContainerBeacon.java @@ -1,10 +1,6 @@ package net.minecraft.server; -// CraftBukkit start -import org.bukkit.craftbukkit.inventory.CraftInventory; -import org.bukkit.craftbukkit.inventory.CraftInventoryBeacon; -import org.bukkit.craftbukkit.inventory.CraftInventoryView; -// CraftBukkit end +import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit public class ContainerBeacon extends Container { @@ -114,7 +110,7 @@ public class ContainerBeacon extends Container { return bukkitEntity; } - CraftInventory inventory = new CraftInventoryBeacon(this.a); + org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon(this.a); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); return bukkitEntity; } diff --git a/src/main/java/net/minecraft/server/ContainerChest.java b/src/main/java/net/minecraft/server/ContainerChest.java index 1ea3d22fb2..d58d955e9c 100644 --- a/src/main/java/net/minecraft/server/ContainerChest.java +++ b/src/main/java/net/minecraft/server/ContainerChest.java @@ -37,7 +37,7 @@ public class ContainerChest extends Container { this.f = iinventory1.getSize() / 9; iinventory1.startOpen(); int i = (this.f - 4) * 18; - // CraftBukkit start - save player + // CraftBukkit start - Save player // TODO: Should we check to make sure it really is an InventoryPlayer? this.player = (PlayerInventory)iinventory; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ContainerDispenser.java b/src/main/java/net/minecraft/server/ContainerDispenser.java index 594477c114..6a8cfd81ca 100644 --- a/src/main/java/net/minecraft/server/ContainerDispenser.java +++ b/src/main/java/net/minecraft/server/ContainerDispenser.java @@ -15,7 +15,7 @@ public class ContainerDispenser extends Container { public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) { this.items = tileentitydispenser; - // CraftBukkit start - save player + // CraftBukkit start - Save player // TODO: Should we check to make sure it really is an InventoryPlayer? this.player = (PlayerInventory)iinventory; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java index 2436d08105..a1d4c9215f 100644 --- a/src/main/java/net/minecraft/server/ContainerWorkbench.java +++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java @@ -19,7 +19,7 @@ public class ContainerWorkbench extends Container { // CraftBukkit end public ContainerWorkbench(PlayerInventory playerinventory, World world, int i, int j, int k) { - // CraftBukkit start - switched order of IInventory construction and stored player + // CraftBukkit start - Switched order of IInventory construction and stored player this.resultInventory = new InventoryCraftResult(); this.craftInventory = new InventoryCrafting(this, 3, 3, playerinventory.player); // CraftBukkit - pass player this.craftInventory.resultInventory = this.resultInventory; diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java index ff81d366c8..32bae80d4d 100644 --- a/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java @@ -271,7 +271,7 @@ public class CraftingManager { j1 = 0; } - // CraftBukkit start - construct a dummy repair recipe + // CraftBukkit start - Construct a dummy repair recipe ItemStack result = new ItemStack(itemstack.id, 1, j1); List ingredients = new ArrayList(); ingredients.add(itemstack.cloneItemStack()); diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java index fbe96fa494..ef7e10d208 100644 --- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java +++ b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java @@ -58,7 +58,7 @@ public class DedicatedServerConnectionThread extends Thread { try { Socket socket = this.d.accept(); - // CraftBukkit start - connection throttle + // CraftBukkit start - Connection throttle InetAddress address = socket.getInetAddress(); long currentTime = System.currentTimeMillis(); diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java index 5bdeac9390..daf50a930c 100644 --- a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java +++ b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java @@ -51,7 +51,7 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem { // CraftBukkit end if (itembucket.a(isourceblock.k(), (double) i, (double) j, (double) k, i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) { - // CraftBukkit start - handle stacked buckets + // CraftBukkit start - Handle stacked buckets Item item = Item.BUCKET; if (--itemstack.count == 0) { itemstack.id = item.id; diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java b/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java index c15c468beb..6fc910b7f3 100644 --- a/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java +++ b/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java @@ -1,7 +1,6 @@ package net.minecraft.server; // CraftBukkit start -import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.event.block.BlockDispenseEvent; // CraftBukkit end @@ -44,8 +43,8 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem { // CraftBukkit end if (world.isEmpty(i, j, k)) { - // CraftBukkit - ignition by dispensing flint and steel - if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) { + // CraftBukkit start - Ignition by dispensing flint and steel + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ()).isCancelled()) { world.setTypeIdUpdate(i, j, k, Block.FIRE.id); if (itemstack.isDamaged(1, world.random)) { itemstack.count = 0; diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 6c00b9cf4e..7890d6f54e 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -368,7 +368,7 @@ public abstract class Entity { protected void z() { if (!this.fireProof) { - // CraftBukkit start - fallen in lava TODO: this event spams! + // CraftBukkit start - Fallen in lava TODO: this event spams! if (this instanceof EntityLiving) { Server server = this.world.getServer(); @@ -705,8 +705,8 @@ public abstract class Entity { this.burn(1); if (!flag2) { ++this.fireTicks; - // CraftBukkit start - not on fire yet - if (this.fireTicks <= 0) { // only throw events on the first combust, otherwise it spams + // CraftBukkit start - Not on fire yet + if (this.fireTicks <= 0) { // Only throw events on the first combust, otherwise it spams EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8); this.world.getServer().getPluginManager().callEvent(event); @@ -1087,7 +1087,7 @@ public abstract class Entity { nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.X, 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 + // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero // TODO: make sure this is the best way to address this. if (Float.isNaN(this.yaw)) { this.yaw = 0; @@ -1139,7 +1139,7 @@ public abstract class Entity { this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data; this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data; this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data; - /* CraftBukkit start - moved section down + /* CraftBukkit start - Moved section down if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; } @@ -1188,7 +1188,7 @@ public abstract class Entity { } // CraftBukkit end - // CraftBukkit start - exempt Vehicles from notch's sanity check + // CraftBukkit start - Exempt Vehicles from notch's sanity check if (!(this.getBukkitEntity() instanceof Vehicle)) { if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; @@ -1204,7 +1204,7 @@ public abstract class Entity { } // CraftBukkit end - // CraftBukkit start - reset world + // CraftBukkit start - Reset world if (this instanceof EntityPlayer) { Server server = Bukkit.getServer(); org.bukkit.World bworld = null; @@ -1402,7 +1402,7 @@ public abstract class Entity { public CraftEntity getBukkitEntity() { if (this.bukkitEntity == null) { - this.bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(this.world.getServer(), this); + this.bukkitEntity = CraftEntity.getEntity(this.world.getServer(), this); } return this.bukkitEntity; } @@ -1607,7 +1607,7 @@ public abstract class Entity { ++this.fireTicks; if (this.fireTicks == 0) { - // CraftBukkit start - raise a combust event when lightning strikes + // CraftBukkit start - Call a combust event when lightning strikes EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); pluginManager.callEvent(entityCombustEvent); if (!entityCombustEvent.isCancelled()) { @@ -1755,11 +1755,11 @@ public abstract class Entity { if (!this.world.isStatic && !this.dead) { this.world.methodProfiler.a("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); - // CraftBukkit start - move logic into new function "teleportToLocation" + // CraftBukkit start - Move logic into new function "teleportToLocation" // int j = this.dimension; WorldServer exitWorld = null; - if (this.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) + if (this.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 : minecraftserver.worlds) { if (world.dimension == i) { exitWorld = world; @@ -1771,7 +1771,7 @@ 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().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.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); @@ -1794,7 +1794,7 @@ public abstract class Entity { this.world.kill(this); this.dead = false; this.world.methodProfiler.a("reposition"); - // CraftBukkit start - ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create + // CraftBukkit start - Ensure chunks are loaded in case TravelAgent is not used which would initially cause chunks to load during find/create // minecraftserver.getPlayerList().a(this, j, worldserver, worldserver1); boolean before = worldserver1.chunkProviderServer.forceChunkLoad; worldserver1.chunkProviderServer.forceChunkLoad = true; @@ -1807,7 +1807,7 @@ public abstract class Entity { if (entity != null) { entity.a(this, true); worldserver1.addEntity(entity); - // CraftBukkit start - forward the CraftEntity to the new entity + // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 4b473647c1..2c0f689ae9 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -231,7 +231,7 @@ public class EntityArrow extends Entity implements IProjectile { damagesource = DamageSource.arrow(this, this.shooter); } - // CraftBukkit start - moved damage call + // CraftBukkit start - Moved damage call if (movingobjectposition.entity.damageEntity(damagesource, i1)) { if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5); diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 827b3a0f1b..4aa3d5900c 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -251,7 +251,7 @@ public class EntityBoat extends Entity { this.motX += this.passenger.motX * this.b; this.motZ += this.passenger.motZ * this.b; } - // CraftBukkit start - block not in vanilla + // CraftBukkit start - Support unoccupied deceleration else if (unoccupiedDeceleration >= 0) { this.motX *= unoccupiedDeceleration; this.motZ *= unoccupiedDeceleration; diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java index c5cf2d29bb..7d06ded225 100644 --- a/src/main/java/net/minecraft/server/EntityChicken.java +++ b/src/main/java/net/minecraft/server/EntityChicken.java @@ -88,7 +88,7 @@ public class EntityChicken extends EntityAnimal { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); int j = this.random.nextInt(3) + this.random.nextInt(1 + i); diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java index 961051215f..748f7abf82 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -55,7 +55,7 @@ public class EntityCow extends EntityAnimal { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); int j = this.random.nextInt(3) + this.random.nextInt(1 + i); @@ -79,7 +79,7 @@ public class EntityCow extends EntityAnimal { ItemStack itemstack = entityhuman.inventory.getItemInHand(); if (itemstack != null && itemstack.id == Item.BUCKET.id) { - // CraftBukkit start - got milk? + // CraftBukkit start - Got milk? org.bukkit.Location loc = this.getBukkitEntity().getLocation(); org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET); diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index 091b8059a7..5752e26764 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -121,7 +121,7 @@ public class EntityCreeper extends EntityMonster { } public void die(DamageSource damagesource) { - // CraftBukkit start - rearranged the method (super call to end, drop to dropDeathLoot) + // CraftBukkit start - Rearranged the method (super call to end, drop to dropDeathLoot) if (damagesource.getEntity() instanceof EntitySkeleton) { int i = Item.RECORD_1.id + this.random.nextInt(Item.RECORD_12.id - Item.RECORD_1.id + 1); @@ -133,7 +133,7 @@ public class EntityCreeper extends EntityMonster { // CraftBukkit end } - // CraftBukkit start - whole method + // CraftBukkit start - Whole method protected void dropDeathLoot(boolean flag, int i) { int j = this.getLootId(); diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java index 43475eef6b..582ecac322 100644 --- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java +++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + public class EntityEnderCrystal extends Entity { public int a = 0; @@ -34,7 +36,7 @@ public class EntityEnderCrystal extends Entity { if (this.world.getTypeId(i, j, k) != Block.FIRE.id) { // CraftBukkit start - if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) { + if (!CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) { this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); } // CraftBukkit end @@ -55,7 +57,7 @@ public class EntityEnderCrystal extends Entity { } else { if (!this.dead && !this.world.isStatic) { // CraftBukkit start - All non-living entities need this - if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) { + if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) { return false; } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java index 6d381bed57..7d4c4f5b66 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -363,7 +363,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { Entity entity = (Entity) list.get(i); if (entity instanceof EntityLiving) { - // CraftBukkit start - throw damage events when the dragon attacks + // CraftBukkit start - Throw damage events when the dragon attacks // The EntityHuman case is handled in EntityHuman, so don't throw it here if (!(entity instanceof EntityHuman)) { EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_ATTACK, 10); @@ -419,7 +419,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { boolean flag = false; boolean flag1 = false; - // CraftBukkit start - create a list to hold all the destroyed blocks + // CraftBukkit start - Create a list to hold all the destroyed blocks List destroyedBlocks = new java.util.ArrayList(); org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld(); // CraftBukkit end @@ -431,7 +431,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { if (j2 != 0) { if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id && this.world.getGameRules().getBoolean("mobGriefing")) { - // CraftBukkit start - add blocks to list rather than destroying them + // CraftBukkit start - Add blocks to list rather than destroying them // flag1 = this.world.setAir(k1, l1, i2) || flag1; flag1 = true; destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2)); @@ -445,12 +445,12 @@ public class EntityEnderDragon extends EntityLiving implements IComplex { } if (flag1) { - // CraftBukkit start - set off an EntityExplodeEvent for the dragon exploding all these blocks + // CraftBukkit start - Set off an EntityExplodeEvent for the dragon exploding all these blocks org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity(); EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { - // this flag literally means 'Dragon hit something hard' (Obsidian, White Stone or Bedrock) and will cause the dragon to slow down. + // This flag literally means 'Dragon hit something hard' (Obsidian, White Stone or Bedrock) and will cause the dragon to slow down. // We should consider adding an event extension for it, or perhaps returning true if the event is cancelled. return flag; } else { diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java index 87d7345502..c82487e515 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -102,7 +102,7 @@ public class EntityEnderman extends EntityMonster { k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D); l = this.world.getTypeId(i, j, k); if (d[l]) { - // CraftBukkit start - pickup event + // 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.setCarriedData(this.world.getData(i, j, k)); @@ -119,7 +119,7 @@ public class EntityEnderman extends EntityMonster { int i1 = this.world.getTypeId(i, j - 1, k); if (l == 0 && i1 > 0 && Block.byId[i1].b()) { - // CraftBukkit start - place event + // 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); @@ -224,7 +224,7 @@ public class EntityEnderman extends EntityMonster { } if (flag1) { - // CraftBukkit start - teleport event + // CraftBukkit start - Teleport event EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ)); this.world.getServer().getPluginManager().callEvent(teleport); if (teleport.isCancelled()) { @@ -285,7 +285,7 @@ public class EntityEnderman extends EntityMonster { int j = this.getLootId(); if (j > 0) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); int count = this.random.nextInt(2 + i); diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java index 96120d872d..17d837dd10 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -3,7 +3,7 @@ package net.minecraft.server; import java.util.ArrayList; import java.util.Iterator; -//CraftBukkit start +// CraftBukkit start import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit end @@ -228,7 +228,7 @@ public class EntityFallingBlock extends Entity { this.tileEntityData = nbttagcompound.getCompound("TileEntityData"); } - // CraftBukkit start - backward compatibility, remove in 1.6 + // CraftBukkit start - Backward compatibility, remove in 1.6 if (nbttagcompound.hasKey("Bukkit.tileData")) { this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone(); } diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 4a19b1d673..84da8cbac8 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -47,7 +47,7 @@ public abstract class EntityFireball extends Entity { this.setPosition(this.locX, this.locY, this.locZ); this.height = 0.0F; this.motX = this.motY = this.motZ = 0.0D; - // CraftBukkit start - (added setDirection method) + // CraftBukkit start - Added setDirection method this.setDirection(d0, d1, d2); } @@ -209,7 +209,7 @@ public abstract class EntityFireball extends Entity { this.g = nbttagcompound.getShort("zTile"); this.h = nbttagcompound.getByte("inTile") & 255; this.i = nbttagcompound.getByte("inGround") == 1; - // CraftBukkit - direction -> power + // CraftBukkit start - direction -> power if (nbttagcompound.hasKey("power")) { NBTTagList nbttaglist = nbttagcompound.getList("power"); diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java index c35a88a6f0..f697d8511c 100644 --- a/src/main/java/net/minecraft/server/EntityHanging.java +++ b/src/main/java/net/minecraft/server/EntityHanging.java @@ -6,7 +6,6 @@ import java.util.List; // CraftBukkit start import org.bukkit.entity.Hanging; import org.bukkit.entity.Painting; -import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.painting.PaintingBreakEvent; // CraftBukkit end @@ -216,7 +215,7 @@ public abstract class EntityHanging extends Entity { HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT); PaintingBreakEvent paintingEvent = null; if (damagesource.getEntity() != null) { - event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity()); + event = new org.bukkit.event.hanging.HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity()); if (this instanceof EntityPainting) { // Fire old painting event until it can be removed diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 1f7b8ad7e5..101c2a0ddd 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -914,7 +914,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.a(StatisticList.w, i); if (l > 0 && flag2) { - // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item + // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4); org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); @@ -1414,7 +1414,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return super.getCustomNameVisible(); } - /* CraftBukkit start - we use canPickUpLoot on players, can't have this + /* CraftBukkit start - We use canPickUpLoot on players, can't have this public boolean bS() { return false; } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 15fbf6926c..9210d9692c 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -366,7 +366,7 @@ public abstract class EntityLiving extends Entity { this.extinguish(); } else { - // CraftBukkit start - only set if needed to work around a datawatcher inefficiency + // CraftBukkit start - Only set if needed to work around a DataWatcher inefficiency if (this.getAirTicks() != 300) { this.setAirTicks(maxAirTicks); } @@ -422,7 +422,7 @@ public abstract class EntityLiving extends Entity { // CraftBukkit start public int getExpReward() { int exp = this.getExpValue(this.killer); - + if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) { return exp; } else { @@ -444,7 +444,7 @@ public abstract class EntityLiving extends Entity { if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) int i; - // CraftBukkit start - update getExpReward() above if the removed if() changes! + // CraftBukkit start - Update getExpReward() above if the removed if() changes! i = this.expToDrop; while (i > 0) { int j = EntityExperienceOrb.getOrbValue(i); @@ -632,7 +632,7 @@ public abstract class EntityLiving extends Entity { this.aE += f2; } - // CraftBukkit start - delegate so we can handle providing a reason for health being regained + // CraftBukkit start - Delegate so we can handle providing a reason for health being regained public void heal(int i) { heal(i, EntityRegainHealthEvent.RegainReason.CUSTOM); } @@ -923,14 +923,14 @@ public abstract class EntityLiving extends Entity { this.world.broadcastEntityEffect(this, (byte) 3); } - // CraftBukkit start - change return type to ItemStack + // CraftBukkit start - Change return type to ItemStack protected ItemStack l(int i) { return null; } // CraftBukkit end protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method List loot = new java.util.ArrayList(); int j = this.getLootId(); @@ -1192,6 +1192,7 @@ public abstract class EntityLiving extends Entity { if (nbttagcompound.hasKey("Bukkit.MaxHealth")) { this.maxHealth = nbttagcompound.getInt("Bukkit.MaxHealth"); } + // CraftBukkit end if (!nbttagcompound.hasKey("Health")) { this.health = this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth @@ -1200,7 +1201,8 @@ public abstract class EntityLiving extends Entity { this.hurtTicks = nbttagcompound.getShort("HurtTime"); this.deathTicks = nbttagcompound.getShort("DeathTime"); this.attackTicks = nbttagcompound.getShort("AttackTime"); - // CraftBukkit start - if looting or persistence is false only use it if it was set after we started using it + + // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it boolean data = nbttagcompound.getBoolean("CanPickUpLoot"); if (isLevelAtLeast(nbttagcompound, 1) || data) { this.canPickUpLoot = data; @@ -1884,7 +1886,7 @@ public abstract class EntityLiving extends Entity { if (this.getGoalTarget() == null) { return 3; } else { - int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // this.getMaxHealth() -> this.maxHealth + int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // CraftBukkit - this.getMaxHealth() -> this.maxHealth i -= (3 - this.world.difficulty) * 4; if (i < 0) { diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java index b63d42e0f6..400662478d 100644 --- a/src/main/java/net/minecraft/server/EntityMagmaCube.java +++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java @@ -34,7 +34,7 @@ public class EntityMagmaCube extends EntitySlime { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); int j = this.getLootId(); diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java index ad54c7ac0d..eed157782b 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java @@ -4,13 +4,11 @@ import java.util.List; // CraftBukkit start import org.bukkit.Location; -import org.bukkit.entity.HumanEntity; import org.bukkit.entity.Vehicle; import org.bukkit.event.vehicle.VehicleDamageEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.vehicle.VehicleEntityCollisionEvent; import org.bukkit.util.Vector; -import org.bukkit.craftbukkit.entity.CraftHumanEntity; // CraftBukkit end public abstract class EntityMinecartAbstract extends Entity { @@ -864,7 +862,7 @@ public abstract class EntityMinecartAbstract extends Entity { return this.c; } - // CraftBukkit start - methods for getting and setting flying and derailed velocity modifiers + // CraftBukkit start - Methods for getting and setting flying and derailed velocity modifiers public Vector getFlyingVelocityMod() { return new Vector(flyingX, flyingY, flyingZ); } diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java index c207076d77..16a4745436 100644 --- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java +++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java @@ -149,6 +149,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp } public void c(int i) { + // CraftBukkit start + for (HumanEntity human : transaction) { + ((org.bukkit.craftbukkit.entity.CraftHumanEntity) human).getHandle().closeInventory(); + } + // CraftBukkit end + this.b = false; super.c(i); } diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index ecace08298..da9d5c6b80 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -41,7 +41,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { if (this.passenger != entity && this.vehicle != entity) { if (entity != this) { - // CraftBukkit start - we still need to call events for entities without goals + // CraftBukkit start - We still need to call events for entities without goals if (entity != this.target && (this instanceof EntityBlaze || this instanceof EntityEnderman || this instanceof EntitySpider || this instanceof EntityGiantZombie || this instanceof EntitySilverfish)) { EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(this, entity, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY); diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index b626215897..8a6dda6023 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -146,10 +146,11 @@ public class EntityPigZombie extends EntityZombie { return false; } - // CraftBukkit start - return rare dropped item instead of dropping it + // CraftBukkit start - Return rare dropped item instead of dropping it protected ItemStack l(int i) { return new ItemStack(Item.GOLD_INGOT.id, 1, 0); } + // CraftBukkit end protected int getLootId() { return Item.ROTTEN_FLESH.id; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 573c0f0449..14f2521e1a 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -102,7 +102,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit } - // CraftBukkit start - world fallback code, either respawn location or global spawn + // CraftBukkit start - World fallback code, either respawn location or global spawn public void spawnIn(World world) { super.spawnIn(world); if (world == null) { @@ -366,7 +366,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } else { if (this.dimension == 1 && i == 0) { this.a((Statistic) AchievementList.B); - // CraftBukkit start - rely on custom portal management + // CraftBukkit start - Rely on custom portal management /* ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn(); @@ -461,7 +461,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void startCrafting(int i, int j, int k) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k)); if(container == null) return; // CraftBukkit end @@ -474,7 +474,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void startEnchanting(int i, int j, int k, String s) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k)); if(container == null) return; // CraftBukkit end @@ -487,7 +487,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openAnvil(int i, int j, int k) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerAnvil(this.inventory, this.world, i, j, k, this)); if(container == null) return; // CraftBukkit end @@ -504,7 +504,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.closeInventory(); } - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory)); if(container == null) return; // CraftBukkit end @@ -517,7 +517,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openHopper(TileEntityHopper tileentityhopper) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper)); if(container == null) return; // CraftBukkit end @@ -530,7 +530,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper)); if(container == null) return; // CraftBukkit end @@ -543,7 +543,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openFurnace(TileEntityFurnace tileentityfurnace) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace)); if(container == null) return; // CraftBukkit end @@ -556,7 +556,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openDispenser(TileEntityDispenser tileentitydispenser) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser)); if(container == null) return; // CraftBukkit end @@ -569,7 +569,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand)); if(container == null) return; // CraftBukkit end @@ -582,7 +582,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openBeacon(TileEntityBeacon tileentitybeacon) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBeacon(this.inventory, tileentitybeacon)); if(container == null) return; // CraftBukkit end @@ -595,7 +595,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void openTrade(IMerchant imerchant, String s) { - // CraftBukkit start - inventory open hook + // CraftBukkit start - Inventory open hook Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world)); if(container == null) return; // CraftBukkit end @@ -638,7 +638,7 @@ 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())); - // CraftBukkit start - send a Set Slot to update the crafting result slot + // 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())); } @@ -835,7 +835,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public WeatherType getPlayerWeather() { return this.weather; } - + public void setPlayerWeather(WeatherType type, boolean plugin) { if (!plugin && this.weather != null) { return; @@ -847,7 +847,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.playerConnection.sendPacket(new Packet70Bed(type == WeatherType.DOWNFALL ? 1 : 2, 0)); } - + public void resetPlayerWeather() { this.weather = null; this.setPlayerWeather(this.o().getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false); diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java index e391ea6fec..a189e1de9b 100644 --- a/src/main/java/net/minecraft/server/EntityPotion.java +++ b/src/main/java/net/minecraft/server/EntityPotion.java @@ -107,7 +107,7 @@ public class EntityPotion extends EntityProjectile { MobEffect mobeffect = (MobEffect) iterator1.next(); int i = mobeffect.getEffectId(); - // CraftBukkit start - abide by PVP settings - for players only! + // CraftBukkit start - Abide by PVP settings - for players only! if (!this.world.pvpMode && this.getShooter() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getShooter()) { // Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) continue; @@ -115,7 +115,7 @@ public class EntityPotion extends EntityProjectile { // CraftBukkit end if (MobEffectList.byId[i].isInstant()) { - // CraftBukkit - added 'this' + // CraftBukkit - Added 'this' MobEffectList.byId[i].applyInstantEffect(this.getShooter(), entityliving, mobeffect.getAmplifier(), d1, this); } else { int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D); diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java index 77f6907527..a1f0fcb4a2 100644 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -62,7 +62,7 @@ public class EntitySheep extends EntityAnimal { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); if (!this.isSheared()) { diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index a69323bf70..ce403c17b0 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -144,7 +144,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); if (this.getSkeletonType() == 1) { diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java index 6d623d106e..abc95ca24a 100644 --- a/src/main/java/net/minecraft/server/EntitySmallFireball.java +++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java @@ -1,9 +1,6 @@ package net.minecraft.server; -// CraftBukkit start -import org.bukkit.craftbukkit.event.CraftEventFactory; -import org.bukkit.event.entity.EntityCombustByEntityEvent; -// CraftBukkit end +import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit public class EntitySmallFireball extends EntityFireball { @@ -26,7 +23,7 @@ public class EntitySmallFireball extends EntityFireball { if (!this.world.isStatic) { if (movingobjectposition.entity != null) { if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5)) { - // CraftBukkit start - entity damage by entity event + combust event + // CraftBukkit start - Entity damage by entity event + combust event EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5); movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event); @@ -67,7 +64,7 @@ public class EntitySmallFireball extends EntityFireball { if (this.world.isEmpty(i, j, k)) { // CraftBukkit start - if (!CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, this).isCancelled()) { this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java index 7761d7178f..a759803461 100644 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -98,7 +98,7 @@ public class EntitySpider extends EntityMonster { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method; adapted from super.dropDeathLoot. + // CraftBukkit start - Whole method; adapted from super.dropDeathLoot. java.util.List loot = new java.util.ArrayList(); int k = this.random.nextInt(3); diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java index 58a81106c7..be8a5ed793 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -51,7 +51,7 @@ public class EntitySquid extends EntityWaterAnimal { } protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method java.util.List loot = new java.util.ArrayList(); int count = this.random.nextInt(3 + i) + 1; diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index ae9ed5233f..4871bd7301 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -73,13 +73,13 @@ public class EntityTrackerEntry { this.broadcast(new Packet39AttachEntity(this.tracker, this.tracker.vehicle)); } - if (this.tracker instanceof EntityItemFrame && this.m % 10 == 0) { + if (this.tracker instanceof EntityItemFrame /*&& this.m % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block EntityItemFrame i4 = (EntityItemFrame) this.tracker; ItemStack i5 = i4.i(); - if (i5 != null && i5.getItem() instanceof ItemWorldMap) { + if (this.m % 10 == 0 && i5 != null && i5.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world); - Iterator j0 = list.iterator(); + Iterator j0 = this.trackedPlayers.iterator(); // CraftBukkit while (j0.hasNext()) { EntityHuman j1 = (EntityHuman) j0.next(); @@ -119,7 +119,7 @@ public class EntityTrackerEntry { boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0; boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4; - // CraftBukkit start - code moved from below + // CraftBukkit start - Code moved from below if (flag) { this.xLoc = i; this.yLoc = j; @@ -143,7 +143,7 @@ public class EntityTrackerEntry { } } else { this.u = 0; - // CraftBukkit start - refresh list of who can see a player before sending teleport packet + // CraftBukkit start - Refresh list of who can see a player before sending teleport packet if (this.tracker instanceof EntityPlayer) { this.scanPlayers(new java.util.ArrayList(this.trackedPlayers)); } @@ -177,7 +177,7 @@ public class EntityTrackerEntry { this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher1, false)); } - /* CraftBukkit start - code moved up + /* CraftBukkit start - Code moved up if (flag) { this.xLoc = i; this.yLoc = j; @@ -225,7 +225,7 @@ public class EntityTrackerEntry { ++this.m; if (this.tracker.velocityChanged) { - // CraftBukkit start - create PlayerVelocity event + // CraftBukkit start - Create PlayerVelocity event boolean cancelled = false; if (this.tracker instanceof EntityPlayer) { @@ -375,7 +375,7 @@ public class EntityTrackerEntry { private Packet b() { if (this.tracker.dead) { - // CraftBukkit start - remove useless error spam, just return + // CraftBukkit start - Remove useless error spam, just return // this.tracker.world.getLogger().warning("Fetching addPacket for removed entity"); return null; // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java index 1790a44d96..176f809909 100644 --- a/src/main/java/net/minecraft/server/EntityWither.java +++ b/src/main/java/net/minecraft/server/EntityWither.java @@ -3,7 +3,7 @@ package net.minecraft.server; import java.util.List; // CraftBukkit start -import org.bukkit.event.entity.EntityRegainHealthEvent; +import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit end @@ -183,7 +183,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.t(i); if (this.ticksLived % 10 == 0) { - this.heal(10, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit + this.heal(10, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit } } else { super.bo(); @@ -268,7 +268,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { if (i3 > 0 && i3 != Block.BEDROCK.id && i3 != Block.ENDER_PORTAL.id && i3 != Block.ENDER_PORTAL_FRAME.id) { // CraftBukkit start - if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, 0, 0).isCancelled()) { + if (CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, 0, 0).isCancelled()) { continue; } // CraftBukkit end @@ -408,7 +408,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { // CraftBukkit start java.util.List loot = new java.util.ArrayList(); loot.add(new org.bukkit.inventory.ItemStack(Item.NETHER_STAR.id, 1)); - org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot); + CraftEventFactory.callEntityDeathEvent(this, loot); // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java index 2afb9761c7..fab412aadc 100644 --- a/src/main/java/net/minecraft/server/EntityWitherSkull.java +++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java @@ -1,9 +1,6 @@ package net.minecraft.server; -// CraftBukkit start -import org.bukkit.event.entity.EntityRegainHealthEvent; -import org.bukkit.event.entity.ExplosionPrimeEvent; -// CraftBukkit end +import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit public class EntityWitherSkull extends EntityFireball { @@ -40,7 +37,7 @@ public class EntityWitherSkull extends EntityFireball { if (movingobjectposition.entity != null) { if (this.shooter != null) { if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8) && !movingobjectposition.entity.isAlive()) { - this.shooter.heal(5, EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit + this.shooter.heal(5, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit } } else { movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5); diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index da478d746c..a7fe3094b8 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -171,7 +171,7 @@ public class EntityZombie extends EntityMonster { return EnumMonsterType.UNDEAD; } - // CraftBukkit start - return rare dropped item instead of dropping it + // CraftBukkit start - Return rare dropped item instead of dropping it protected ItemStack l(int i) { switch (this.random.nextInt(3)) { case 0: diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java index 50646cef06..b43953a018 100644 --- a/src/main/java/net/minecraft/server/Explosion.java +++ b/src/main/java/net/minecraft/server/Explosion.java @@ -131,7 +131,7 @@ public class Explosion { double d9 = (double) this.world.a(vec3d, entity.boundingBox); double d10 = (1.0D - d7) * d9; - // CraftBukkit start - explosion damage hook + // CraftBukkit start - Explosion damage hook org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D); @@ -290,10 +290,11 @@ public class Explosion { int i1 = this.world.getTypeId(i, j - 1, k); if (l == 0 && Block.s[i1] && this.j.nextInt(3) == 0) { - // CraftBukkit start - ignition by explosion. + // CraftBukkit start - Ignition by explosion if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) { this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id); - } // CraftBukkit end + } + // CraftBukkit end } } } diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index 40bf6decf2..0242c365ac 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -4,7 +4,7 @@ import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit public class FoodMetaData { - // CraftBukkit start - all made public + // CraftBukkit start - All made public public int foodLevel = 20; public float saturationLevel = 5.0F; public float exhaustionLevel; diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java index c2d19482ff..ba2feafde1 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -56,7 +56,7 @@ public class ItemBlock extends Item { int j1 = this.filterData(itemstack.getData()); int k1 = Block.byId[this.id].getPlacedData(world, i, j, k, l, f, f1, f2, j1); - // CraftBukkit start - redirect to common function handler + // CraftBukkit start - Redirect to common function handler /* if (world.setTypeIdAndData(i, j, k, this.id, k1, 3)) { if (world.getTypeId(i, j, k) == this.id) { @@ -75,7 +75,7 @@ public class ItemBlock extends Item { } } - // CraftBukkit start - add method to process block placement + // CraftBukkit start - Add method to process block placement static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data, final int clickedX, final int clickedY, final int clickedZ) { org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z); diff --git a/src/main/java/net/minecraft/server/ItemDye.java b/src/main/java/net/minecraft/server/ItemDye.java index 4f3b46adbf..cb971d74f8 100644 --- a/src/main/java/net/minecraft/server/ItemDye.java +++ b/src/main/java/net/minecraft/server/ItemDye.java @@ -189,7 +189,7 @@ public class ItemDye extends Item { } else { if (!world.isStatic) { if ((double) world.random.nextFloat() < 0.4D) { - // CraftBukkit start - validate + // CraftBukkit start - Validate Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null; ((BlockMushroom) Block.byId[l]).grow(world, i, j, k, world.random, true, player, itemstack); } diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java index 550a3c4242..7b92c92fd3 100644 --- a/src/main/java/net/minecraft/server/ItemFishingRod.java +++ b/src/main/java/net/minecraft/server/ItemFishingRod.java @@ -1,9 +1,6 @@ package net.minecraft.server; -// CraftBukkit start -import org.bukkit.event.player.PlayerFishEvent; -import org.bukkit.entity.Fish; -// CraftBukkit end +import org.bukkit.event.player.PlayerFishEvent; // CraftBukkit public class ItemFishingRod extends Item { @@ -23,7 +20,7 @@ public class ItemFishingRod extends Item { } else { // CraftBukkit start EntityFishingHook hook = new EntityFishingHook(world, entityhuman); - PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING); + PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING); world.getServer().getPluginManager().callEvent(playerFishEvent); if (playerFishEvent.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java index 988b8ef4d0..3f106a5ef7 100644 --- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java +++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java @@ -1,6 +1,9 @@ package net.minecraft.server; -import org.bukkit.craftbukkit.block.CraftBlockState; // CraftBukkit +// CraftBukkit start +import org.bukkit.craftbukkit.block.CraftBlockState; +import org.bukkit.craftbukkit.event.CraftEventFactory; +// CraftBukkit end public class ItemFlintAndSteel extends Item { @@ -44,8 +47,8 @@ public class ItemFlintAndSteel extends Item { int i1 = world.getTypeId(i, j, k); if (i1 == 0) { - // CraftBukkit start - store the clicked block - if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { + // CraftBukkit start - Store the clicked block + if (CraftEventFactory.callBlockIgniteEvent(world, i, j, k, org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { itemstack.damage(1, entityhuman); return false; } @@ -57,7 +60,7 @@ public class ItemFlintAndSteel extends Item { world.setTypeIdUpdate(i, j, k, Block.FIRE.id); // CraftBukkit start - org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ); + org.bukkit.event.block.BlockPlaceEvent placeEvent = CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ); if (placeEvent.isCancelled() || !placeEvent.canBuild()) { placeEvent.getBlockPlaced().setTypeIdAndData(0, (byte) 0, false); diff --git a/src/main/java/net/minecraft/server/ItemReed.java b/src/main/java/net/minecraft/server/ItemReed.java index 156218d8f1..f3a3c0e058 100644 --- a/src/main/java/net/minecraft/server/ItemReed.java +++ b/src/main/java/net/minecraft/server/ItemReed.java @@ -50,7 +50,7 @@ public class ItemReed extends Item { Block block = Block.byId[this.id]; int j1 = block.getPlacedData(world, i, j, k, l, f, f1, f2, 0); - // CraftBukkit start - redirect to common handler + // CraftBukkit start - Redirect to common handler ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, j1, clickedX, clickedY, clickedZ); /* if (world.setTypeIdAndData(i, j, k, this.id, j1, 3)) { diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java index 8042681c08..bd1a46f170 100644 --- a/src/main/java/net/minecraft/server/ItemSeeds.java +++ b/src/main/java/net/minecraft/server/ItemSeeds.java @@ -20,7 +20,7 @@ public class ItemSeeds extends Item { int i1 = world.getTypeId(i, j, k); if (i1 == this.b && world.isEmpty(i, j + 1, k)) { - // CraftBukkit start - seeds + // CraftBukkit start - Seeds // world.setTypeIdUpdate(i, j + 1, k, this.id); if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.id, 0, clickedX, clickedY, clickedZ)) { return false; diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java index 960927225d..9d8f8ffbd9 100644 --- a/src/main/java/net/minecraft/server/ItemSkull.java +++ b/src/main/java/net/minecraft/server/ItemSkull.java @@ -44,7 +44,7 @@ public class ItemSkull extends Item { } else if (!Block.SKULL.canPlace(world, i, j, k)) { return false; } else { - // CraftBukkit start - handle in ItemBlock + // CraftBukkit start - Handle in ItemBlock // world.setTypeIdAndData(i, j, k, Block.SKULL.id, l, 2); if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l, clickedX, clickedY, clickedZ)) { return false; diff --git a/src/main/java/net/minecraft/server/ItemSnow.java b/src/main/java/net/minecraft/server/ItemSnow.java index 3018ec1f0a..916aecc0e5 100644 --- a/src/main/java/net/minecraft/server/ItemSnow.java +++ b/src/main/java/net/minecraft/server/ItemSnow.java @@ -20,7 +20,7 @@ public class ItemSnow extends ItemBlockWithAuxData { int j1 = world.getData(i, j, k); int k1 = j1 & 7; - // CraftBukkit start - redirect to common handler + // CraftBukkit start - Redirect to common handler if (k1 <= 6 && world.b(block.b(world, i, j, k)) && ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.SNOW.id, k1 + 1 | j1 & -8, clickedX, clickedY, clickedZ)) { return true; } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 68e481c6ab..7dc36a824b 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -40,7 +40,7 @@ public final class ItemStack { this.f = null; this.id = i; this.count = j; - // CraftBukkit start - pass to setData to do filtering + // CraftBukkit start - Pass to setData to do filtering this.setData(k); //if (this.damage < 0) { // this.damage = 0; @@ -151,7 +151,7 @@ public final class ItemStack { } public void setData(int i) { - // CraftBukkit start - filter out data for items that shouldn't have it + // CraftBukkit start - Filter out data for items that shouldn't have it // The crafting system uses this value for a special purpose so we have to allow it if (i == 32767) { this.damage = i; diff --git a/src/main/java/net/minecraft/server/ItemWaterLily.java b/src/main/java/net/minecraft/server/ItemWaterLily.java index bcee9b811f..691ad467b3 100644 --- a/src/main/java/net/minecraft/server/ItemWaterLily.java +++ b/src/main/java/net/minecraft/server/ItemWaterLily.java @@ -27,7 +27,7 @@ public class ItemWaterLily extends ItemWithAuxData { } if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) { - // CraftBukkit start - waterlily + // CraftBukkit start // world.setTypeIdUpdate(i, j + 1, k, Block.WATER_LILY.id); if (!processBlockPlace(world, entityhuman, null, i, j + 1, k, Block.WATER_LILY.id, 0, clickedX, clickedY, clickedZ)) { return itemstack; diff --git a/src/main/java/net/minecraft/server/MethodProfiler.java b/src/main/java/net/minecraft/server/MethodProfiler.java index 0dfdfa7bf2..e56157cbdc 100644 --- a/src/main/java/net/minecraft/server/MethodProfiler.java +++ b/src/main/java/net/minecraft/server/MethodProfiler.java @@ -7,7 +7,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -// CraftBukkit start - strip down to empty +// CraftBukkit start - Strip down to empty methods, performance cost public class MethodProfiler { public boolean a = false; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 5c535cc66b..5bf5fdc25a 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -13,10 +13,8 @@ import java.util.logging.Level; import java.util.logging.Logger; // CraftBukkit start -import java.util.concurrent.ExecutionException; import java.io.IOException; -import com.google.common.io.Files; import jline.console.ConsoleReader; import joptsimple.OptionSet; @@ -106,7 +104,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo org.bukkit.craftbukkit.Main.useJline = false; this.reader = new ConsoleReader(System.in, System.out); this.reader.setExpandEvents(false); - } catch (java.io.IOException ex) { + } catch (IOException ex) { Logger.getLogger(MinecraftServer.class.getName()).log(Level.SEVERE, null, ex); } } @@ -140,10 +138,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo this.b(s); this.c("menu.loadingLevel"); this.worldServer = new WorldServer[3]; - // CraftBukkit - removed ticktime arrays + // CraftBukkit - Removed ticktime arrays IDataManager idatamanager = this.convertable.a(s, true); WorldData worlddata = idatamanager.getWorldData(); - // CraftBukkit start - removed worldsettings + // CraftBukkit start - Removed worldsettings int worldCount = 3; for (int j = 0; j < worldCount; ++j) { @@ -202,7 +200,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo log.info("Success! To restore " + worldType + " in the future, simply move " + newWorld + " to " + oldWorld); // Migrate world data too. try { - Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat")); + com.google.common.io.Files.copy(new File(new File(s), "level.dat"), new File(new File(name), "level.dat")); } catch (IOException exception) { log.severe("Unable to migrate world data."); } @@ -347,7 +345,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo this.getLogger().info("Saving worlds"); this.saveChunks(false); - /* CraftBukkit start - handled in saveChunks + /* CraftBukkit start - Handled in saveChunks for (int i = 0; i < this.worldServer.length; ++i) { WorldServer worldserver = this.worldServer[i]; @@ -442,7 +440,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } catch (Throwable throwable1) { throwable1.printStackTrace(); } finally { - // CraftBukkit start - restore terminal to original settings + // CraftBukkit start - Restore terminal to original settings try { this.reader.getTerminal().restore(); } catch (Exception e) { @@ -508,7 +506,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo public void r() { this.methodProfiler.a("levels"); - // CraftBukkit start - only send timeupdates to the people in that world + // CraftBukkit start this.server.getScheduler().mainThreadHeartbeat(this.ticks); // Run tasks that are waiting on processing @@ -518,7 +516,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo org.bukkit.craftbukkit.chunkio.ChunkIOExecutor.tick(); - // Send timeupdates to everyone, it will get the right time from the world the player is in. + // Send time updates to everyone, it will get the right time from the world the player is in. if (this.ticks % 20 == 0) { for (int i = 0; i < this.getPlayerList().players.size(); ++i) { EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i); @@ -602,7 +600,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo IConsoleLogManager iconsolelogmanager = null; try { - /* CraftBukkit start - replace everything + /* CraftBukkit start - Replace everything boolean flag = false; String s = null; String s1 = "."; @@ -762,7 +760,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } public String getPlugins() { - // CraftBukkit start - whole method + // CraftBukkit start - Whole method StringBuilder result = new StringBuilder(); org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins(); @@ -806,7 +804,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo processQueue.add(waitable); try { return waitable.get(); - } catch (ExecutionException e) { + } catch (java.util.concurrent.ExecutionException e) { throw new RuntimeException("Exception processing rcon command " + s, e.getCause()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); // Maintain interrupted state diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java index f325bef1c5..8ec6d25362 100644 --- a/src/main/java/net/minecraft/server/MobEffectList.java +++ b/src/main/java/net/minecraft/server/MobEffectList.java @@ -114,7 +114,7 @@ public class MobEffectList { } public void applyInstantEffect(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0) { - // CraftBukkit start - delegate; we need EntityPotion + // CraftBukkit start - Delegate; we need EntityPotion applyInstantEffect(entityliving, entityliving1, i, d0, null); } diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java index b82596fc1f..36435959b4 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java @@ -23,7 +23,7 @@ public abstract class Packet { public static long q; public static long r; public boolean lowPriority = false; - // CraftBukkit start - calculate packet ID once - used a bunch of times + // CraftBukkit start - Calculate packet ID once - used a bunch of times private int packetID; public Packet() { diff --git a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java index 68e48ef62b..1d4a4311a9 100644 --- a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java +++ b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java @@ -24,7 +24,7 @@ public class Packet20NamedEntitySpawn extends Packet { public Packet20NamedEntitySpawn(EntityHuman entityhuman) { this.a = entityhuman.id; - // CraftBukkit start - limit name length to 16 characters + // CraftBukkit start - Limit name length to 16 characters if (entityhuman.name.length() > 16) { this.b = entityhuman.name.substring(0, 16); } else { diff --git a/src/main/java/net/minecraft/server/Packet3Chat.java b/src/main/java/net/minecraft/server/Packet3Chat.java index b8f3f25dc6..e48348bcdb 100644 --- a/src/main/java/net/minecraft/server/Packet3Chat.java +++ b/src/main/java/net/minecraft/server/Packet3Chat.java @@ -22,7 +22,7 @@ public class Packet3Chat extends Packet { public Packet3Chat(String s, boolean flag) { this.c = true; - /* CraftBukkit start - handle this later + /* CraftBukkit start - Handle this later if (s.length() > b) { s = s.substring(0, b); } diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java index 867ebd3abc..129dc4f101 100644 --- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java +++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java @@ -62,7 +62,7 @@ public class Packet56MapChunkBulk extends Packet { this.inflatedBuffers[k] = chunkmap.a; } - /* CraftBukkit start - moved to compress() + /* CraftBukkit start - Moved to compress() Deflater deflater = new Deflater(-1); try { diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java index 1b0340f918..f6110a2323 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java @@ -1,6 +1,9 @@ package net.minecraft.server; -import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit +// CraftBukkit start +import org.bukkit.craftbukkit.entity.CraftEntity; +import org.bukkit.event.entity.EntityTargetEvent; +// CraftBukkit end public abstract class PathfinderGoalTarget extends PathfinderGoal { @@ -99,7 +102,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { } } - // CraftBukkit start - check all the different target goals for the reason, default to RANDOM_TARGET + // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET; if (this instanceof PathfinderGoalDefendVillage) { @@ -121,10 +124,10 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { this.d.setGoalTarget(null); return false; } else if (entityliving.getBukkitEntity() != event.getTarget()) { - this.d.setGoalTarget((EntityLiving) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle()); + this.d.setGoalTarget((EntityLiving) ((CraftEntity) event.getTarget()).getHandle()); } if (this.d instanceof EntityCreature) { - ((EntityCreature) this.d).target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); + ((EntityCreature) this.d).target = ((CraftEntity) event.getTarget()).getHandle(); } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java index 5f4bcf2a65..eb474f5b47 100644 --- a/src/main/java/net/minecraft/server/PendingConnection.java +++ b/src/main/java/net/minecraft/server/PendingConnection.java @@ -147,7 +147,7 @@ public class PendingConnection extends Connection { org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers()); if (packet254getinfo.a == 1) { - // CraftBukkit start - fix decompile issues, don't create a list from an array + // CraftBukkit start - Fix decompile issues, don't create a list from an array Object[] list = new Object[] { 1, 60, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() }; for (Object object : list) { diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java index 5350644321..10a43b6486 100644 --- a/src/main/java/net/minecraft/server/PlayerChunk.java +++ b/src/main/java/net/minecraft/server/PlayerChunk.java @@ -26,6 +26,7 @@ class PlayerChunk { PlayerChunk.this.loaded = true; } }); + // CraftBukkit end } public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java index f788a62e3a..0dfd1907bc 100644 --- a/src/main/java/net/minecraft/server/PlayerChunkMap.java +++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java @@ -6,7 +6,6 @@ import java.util.List; // CraftBukkit start import java.util.Collections; import java.util.Queue; -import java.util.Iterator; import java.util.LinkedList; // CraftBukkit end @@ -36,8 +35,8 @@ public class PlayerChunkMap { } public void flush() { - // CraftBukkit start - use iterator - Iterator iterator = this.d.iterator(); + // CraftBukkit start - Use iterator + java.util.Iterator iterator = this.d.iterator(); while (iterator.hasNext()) { PlayerChunk playerinstance = (PlayerChunk) iterator.next(); @@ -46,9 +45,9 @@ public class PlayerChunkMap { } // CraftBukkit end - // this.d.clear(); // CraftBukkit - removals are already covered + // this.d.clear(); // CraftBukkit - Removals are already covered if (this.managedPlayers.isEmpty()) { - if (!wasNotEmpty) return; // CraftBukkit - only do unload when we go from non-empty to empty + if (!wasNotEmpty) return; // CraftBukkit - Only do unload when we go from non-empty to empty WorldProvider worldprovider = this.world.worldProvider; if (!worldprovider.e()) { @@ -100,7 +99,7 @@ public class PlayerChunkMap { entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; - // CraftBukkit start - load nearby chunks first + // CraftBukkit start - Load nearby chunks first List chunkList = new LinkedList(); for (int k = i - this.e; k <= i + this.e; ++k) { for (int l = j - this.e; l <= j + this.e; ++l) { @@ -258,7 +257,7 @@ public class PlayerChunkMap { return playermanager.d; } - // CraftBukkit start - sorter to load nearby chunks first + // CraftBukkit start - Sorter to load nearby chunks first private static class ChunkCoordComparator implements java.util.Comparator { private int x; private int z; diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index 00c6861528..c81793a1b1 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -12,22 +12,23 @@ import java.util.concurrent.Callable; import java.io.UnsupportedEncodingException; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -import java.util.logging.Level; import java.util.HashSet; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.event.CraftEventFactory; + +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.InventoryClickEvent; +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; @@ -37,13 +38,9 @@ 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.PlayerTeleportEvent.TeleportCause; +import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.event.player.PlayerToggleSneakEvent; import org.bukkit.event.player.PlayerToggleSprintEvent; -import org.bukkit.event.inventory.*; -import org.bukkit.event.inventory.InventoryType.SlotType; -import org.bukkit.event.player.PlayerPortalEvent; -import org.bukkit.event.player.PlayerToggleFlightEvent; import org.bukkit.inventory.CraftingInventory; import org.bukkit.inventory.InventoryView; // CraftBukkit end @@ -688,10 +685,10 @@ public class PlayerConnection extends Connection { } public void a(String s, Object[] aobject) { - if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice + if (this.disconnected) return; // CraftBukkit - Rarely it would send a disconnect line twice this.minecraftServer.getLogger().info(this.player.name + " lost connection: " + s); - // CraftBukkit start - we need to handle custom quit messages + // 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().sendAll(new Packet3Chat(quitMessage)); @@ -845,7 +842,6 @@ public class PlayerConnection extends Connection { // This section stays because it is only applicable to packets if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam - // CraftBukkit start if (packet3chat.a_()) { Waitable waitable = new Waitable() { @Override @@ -867,7 +863,6 @@ public class PlayerConnection extends Connection { } else { this.disconnect("disconnect.spam"); } - // CraftBukkit end } } } @@ -900,7 +895,7 @@ public class PlayerConnection extends Connection { Waitable waitable = new Waitable() { @Override protected Object evaluate() { - Bukkit.getPluginManager().callEvent(queueEvent); + org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent); if (queueEvent.isCancelled()) { return null; @@ -973,7 +968,7 @@ public class PlayerConnection extends Connection { } } 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(Level.SEVERE, null, ex); + java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); return; } // CraftBukkit end @@ -987,7 +982,7 @@ public class PlayerConnection extends Connection { if (this.player.dead) return; // CraftBukkit if (packet18armanimation.b == 1) { - // CraftBukkit start - raytrace to look for 'rogue armswings' + // 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; @@ -1092,7 +1087,7 @@ public class PlayerConnection extends Connection { } // CraftBukkit end this.player.p(entity); - // CraftBukkit start - update the client if the item is an infinite one + // CraftBukkit start - Update the client if the item is an infinite one if (itemInHand != null && itemInHand.count <= -1) { this.player.updateInventory(this.player.activeContainer); } @@ -1118,7 +1113,7 @@ public class PlayerConnection extends Connection { public void a(Packet205ClientCommand packet205clientcommand) { if (packet205clientcommand.a == 1) { if (this.player.viewingCredits) { - this.minecraftServer.getPlayerList().changeDimension(this.player, 0, TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management + this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management } else if (this.player.o().getWorldData().isHardcore()) { if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) { this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); @@ -1149,7 +1144,7 @@ public class PlayerConnection extends Connection { public void handleContainerClose(Packet101CloseWindow packet101closewindow) { if (this.player.dead) return; // CraftBukkit - // CraftBukkit start - INVENTORY_CLOSE hook + // CraftBukkit start InventoryCloseEvent event = new InventoryCloseEvent(this.player.activeContainer.getBukkitView()); server.getPluginManager().callEvent(event); this.player.activeContainer.transferTo(this.player.defaultContainer, getPlayer()); @@ -1162,7 +1157,7 @@ public class PlayerConnection extends Connection { if (this.player.dead) return; // CraftBukkit if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) { - // CraftBukkit start - fire InventoryClickEvent + // CraftBukkit start - Call InventoryClickEvent if (packet102windowclick.slot == -1) { // Vanilla doesn't do anything with this, neither should we return; @@ -1176,7 +1171,7 @@ public class PlayerConnection extends Connection { if (packet102windowclick.slot == 0 && top instanceof CraftingInventory) { org.bukkit.inventory.Recipe recipe = ((CraftingInventory) top).getRecipe(); if (recipe != null) { - event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1); + event = new org.bukkit.event.inventory.CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift == 1); } } server.getPluginManager().callEvent(event); @@ -1231,7 +1226,7 @@ public class PlayerConnection extends Connection { this.player.a(this.player.activeContainer, arraylist); - // CraftBukkit start - send a Set Slot to update the crafting result slot + // 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))); } @@ -1256,7 +1251,7 @@ public class PlayerConnection extends Connection { 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 - Fire INVENTORY_CLICK event + // CraftBukkit start - Call click event org.bukkit.entity.HumanEntity player = this.player.getBukkitEntity(); InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer); SlotType slot = SlotType.QUICKBAR; @@ -1441,7 +1436,7 @@ public class PlayerConnection extends Connection { ItemStack itemstack; ItemStack itemstack1; - // CraftBukkit start - ignore empty payloads + // CraftBukkit start - Ignore empty payloads if (packet250custompayload.length <= 0) { return; } diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java index 92e68be252..91bed162c9 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -32,12 +32,6 @@ public class PlayerInteractManager { this.world = world; } - // CraftBukkit start - keep this for backwards compatibility - public PlayerInteractManager(WorldServer world) { - this((World) world); - } - // CraftBukkit end - public void setGameMode(EnumGamemode enumgamemode) { this.gamemode = enumgamemode; enumgamemode.a(this.player.abilities); @@ -216,9 +210,9 @@ public class PlayerInteractManager { this.n = this.lastDigTick; } } - // CraftBukkit start - force blockreset to client + // CraftBukkit start - Force block reset to client } else { - ((EntityPlayer) this.player).playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world)); + this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world)); // CraftBukkit end } } @@ -298,10 +292,10 @@ public class PlayerInteractManager { return false; } else { int l = this.world.getTypeId(i, j, k); - if (Block.byId[l] == null) return false; // CraftBukkit - a plugin set block to air without cancelling + if (Block.byId[l] == null) return false; // CraftBukkit - A plugin set block to air without cancelling int i1 = this.world.getData(i, j, k); - // CraftBukkit start - special case skulls, their item data comes from a tile entity + // CraftBukkit start - Special case skulls, their item data comes from a tile entity if (l == Block.SKULL.id && !this.isCreative()) { Block.SKULL.dropNaturally(world, i, j, k, i1, 1.0F, 0); return this.d(i, j, k); @@ -329,7 +323,7 @@ public class PlayerInteractManager { } } - // CraftBukkit start - drop event experience + // CraftBukkit start - Drop event experience if (flag && event != null) { Block.byId[l].j(this.world, i, j, k, event.getExpToDrop()); } diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java index 63da3ad459..7bf2c6f32c 100644 --- a/src/main/java/net/minecraft/server/PlayerInventory.java +++ b/src/main/java/net/minecraft/server/PlayerInventory.java @@ -83,7 +83,7 @@ public class PlayerInventory implements IInventory { return -1; } - // CraftBukkit start - watch method above! :D + // CraftBukkit start - Watch method above! :D public int canHold(ItemStack itemstack) { int remains = itemstack.count; for (int i = 0; i < this.items.length; ++i) { diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index 6efb5b6a99..464b25094d 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -13,23 +13,22 @@ import java.util.Set; import java.util.Map.Entry; // CraftBukkit start -import org.bukkit.Location; -import org.bukkit.TravelAgent; -import org.bukkit.WeatherType; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; -import org.bukkit.craftbukkit.entity.CraftPlayer; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.TravelAgent; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerPortalEvent; -import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.util.Vector; -import org.bukkit.Bukkit; // CraftBukkit end public abstract class PlayerList { @@ -214,7 +213,7 @@ public abstract class PlayerList { ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit end - // CraftBukkit start - only add if the player wasn't moved in the event + // CraftBukkit start - Only add if the player wasn't moved in the event if (entityplayer.world == worldserver && !worldserver.players.contains(entityplayer)) { worldserver.addEntity(entityplayer); this.a(entityplayer, (WorldServer) null); @@ -250,7 +249,7 @@ public abstract class PlayerList { public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string if (entityplayer.playerConnection.disconnected) return null; // CraftBukkit - exploitsies fix - // CraftBukkit start - quitting must be before we do final save of data, in case plugins need to modify it + // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(this.cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.name + " left the game."); this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); @@ -450,7 +449,7 @@ public abstract class PlayerList { worldserver.getPlayerChunkMap().addPlayer(entityplayer1); worldserver.addEntity(entityplayer1); this.players.add(entityplayer1); - // CraftBukkit start - added from changeDimension + // CraftBukkit start - Added from changeDimension this.updateClient(entityplayer1); // CraftBukkit entityplayer1.updateAbilities(); Iterator iterator = entityplayer1.getEffects().iterator(); @@ -464,7 +463,7 @@ public abstract class PlayerList { // 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); @@ -492,7 +491,7 @@ public abstract class PlayerList { if (exitWorld != null) { if ((cause == TeleportCause.END_PORTAL) && (i == 0)) { // THE_END -> NORMAL; use bed if available, otherwise default spawn - exit = ((CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); + exit = ((org.bukkit.craftbukkit.entity.CraftPlayer) entityplayer.getBukkitEntity()).getBedSpawnLocation(); if (exit == null || ((CraftWorld) exit.getWorld()).getHandle().dimension != 0) { exit = exitWorld.getWorld().getSpawnLocation(); } @@ -531,12 +530,12 @@ public abstract class PlayerList { } public void a(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { - // CraftBukkit start - split into modular functions + // CraftBukkit start - Split into modular functions Location exit = this.calculateTarget(entity.getBukkitEntity().getLocation(), worldserver1); this.repositionEntity(entity, exit, true); } - // copy of original a(Entity, int, WorldServer, WorldServer) method with only location calculation logic + // Copy of original a(Entity, int, WorldServer, WorldServer) method with only location calculation logic public Location calculateTarget(Location enter, World target) { WorldServer worldserver = ((CraftWorld) enter.getWorld()).getHandle(); WorldServer worldserver1 = ((CraftWorld) target.getWorld()).getHandle(); @@ -707,7 +706,7 @@ public abstract class PlayerList { this.n = 0; } - /* CraftBukkit start - remove updating of lag to players -- it spams way to much on big servers. + /* 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); @@ -976,7 +975,7 @@ public abstract class PlayerList { public void b(EntityPlayer entityplayer, WorldServer worldserver) { entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime())); if (worldserver.O()) { - entityplayer.setPlayerWeather(WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather + entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather } } diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java index 5eafb576ac..d1ff061491 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -30,14 +30,14 @@ public class PortalTravelAgent { this.b(entity, d0, d1, d2, f); } } else { - // CraftBukkit start - modularize end portal creation + // CraftBukkit start - Modularize end portal creation ChunkCoordinates created = this.createEndPortal(d0, d1, d2); entity.setPositionRotation((double) created.x, (double) created.y, (double) created.z, entity.yaw, 0.0F); entity.motX = entity.motY = entity.motZ = 0.0D; } } - // split out from original a(Entity, double, double, double, float) method in order to enable being called from createPortal + // Split out from original a(Entity, double, double, double, float) method in order to enable being called from createPortal private ChunkCoordinates createEndPortal(double x, double y, double z) { int i = MathHelper.floor(x); int j = MathHelper.floor(y) - 1; @@ -90,7 +90,7 @@ public class PortalTravelAgent { // CraftBukkit end public boolean b(Entity entity, double d0, double d1, double d2, float f) { - // CraftBukkit start - modularize portal search process and entity teleportation + // CraftBukkit start - Modularize portal search process and entity teleportation ChunkCoordinates found = this.findPortal(entity.locX, entity.locY, entity.locZ, 128); if (found == null) { return false; @@ -166,13 +166,13 @@ public class PortalTravelAgent { this.c.put(j1, new ChunkCoordinatesPortal(this, i, j, k, this.a.getTime())); this.d.add(Long.valueOf(j1)); } - // CraftBukkit start - moved entity teleportation logic into exit + // CraftBukkit start - Moved entity teleportation logic into exit return new ChunkCoordinates(i, j, k); } else { return null; } } - // entity repositioning logic split out from original b method and combined with repositioning logic for The End from original a method + // Entity repositioning logic split out from original b method and combined with repositioning logic for The End from original a method public void adjustExit(Entity entity, Location position, Vector velocity) { Location from = position.clone(); Vector before = velocity.clone(); @@ -279,7 +279,7 @@ public class PortalTravelAgent { double d11 = velocity.getZ(); // CraftBukkit end - // CraftBukkit start - adjust position and velocity instances instead of entity + // CraftBukkit start - Adjust position and velocity instances instead of entity velocity.setX(d10 * (double) f3 + d11 * (double) f6); velocity.setZ(d10 * (double) f5 + d11 * (double) f4); f = f - (float) (k2 * 90) + (float) (j2 * 90); @@ -319,7 +319,7 @@ public class PortalTravelAgent { } public boolean a(Entity entity) { - // CraftBukkit start - allow for portal creation to be based on coordinates instead of entity + // CraftBukkit start - Allow for portal creation to be based on coordinates instead of entity return this.createPortal(entity.locX, entity.locY, entity.locZ, 16); } diff --git a/src/main/java/net/minecraft/server/RecipeArmorDye.java b/src/main/java/net/minecraft/server/RecipeArmorDye.java index 0b89265aff..38a9b461dc 100644 --- a/src/main/java/net/minecraft/server/RecipeArmorDye.java +++ b/src/main/java/net/minecraft/server/RecipeArmorDye.java @@ -4,7 +4,7 @@ import java.util.ArrayList; public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - // CraftBukkit start - delegate to new parent class with bogus info + // CraftBukkit start - Delegate to new parent class with bogus info public RecipeArmorDye() { super(new ItemStack(Item.LEATHER_HELMET, 0, 0), java.util.Arrays.asList(new ItemStack(Item.INK_SACK, 0, 5))); } diff --git a/src/main/java/net/minecraft/server/RecipeFireworks.java b/src/main/java/net/minecraft/server/RecipeFireworks.java index 43caa90518..780a417c5b 100644 --- a/src/main/java/net/minecraft/server/RecipeFireworks.java +++ b/src/main/java/net/minecraft/server/RecipeFireworks.java @@ -6,7 +6,7 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr private ItemStack a; - // CraftBukkit start - delegate to new parent class with bogus info + // CraftBukkit start - Delegate to new parent class with bogus info public RecipeFireworks() { super(new ItemStack(Item.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Item.SULPHUR, 0, 5))); } diff --git a/src/main/java/net/minecraft/server/RecipeMapClone.java b/src/main/java/net/minecraft/server/RecipeMapClone.java index 97539ecdd0..7e9e2c9dbb 100644 --- a/src/main/java/net/minecraft/server/RecipeMapClone.java +++ b/src/main/java/net/minecraft/server/RecipeMapClone.java @@ -2,7 +2,7 @@ package net.minecraft.server; public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - // CraftBukkit start - delegate to new parent class + // CraftBukkit start - Delegate to new parent class public RecipeMapClone() { super(new ItemStack(Item.MAP, 0, -1), java.util.Arrays.asList(new ItemStack(Item.MAP_EMPTY, 0, 0))); } diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java index 07a8888f6c..2a9be3de5f 100644 --- a/src/main/java/net/minecraft/server/RegionFile.java +++ b/src/main/java/net/minecraft/server/RegionFile.java @@ -87,7 +87,7 @@ public class RegionFile { } } - // CraftBukkit start - this is a copy (sort of) of the method below it, make sure they stay in sync + // CraftBukkit start - This is a copy (sort of) of the method below it, make sure they stay in sync public synchronized boolean chunkExists(int i, int j) { if (this.d(i, j)) { return false; diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index 2d1a37239b..b3e2818564 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -68,7 +68,7 @@ public final class SpawnerCreature { for (int j1 = 0; j1 < j; ++j1) { EnumCreatureType enumcreaturetype = aenumcreaturetype[j1]; - // CraftBukkit start - use per-world spawn limits + // CraftBukkit start - Use per-world spawn limits int limit = enumcreaturetype.b(); switch (enumcreaturetype) { case MONSTER: @@ -154,7 +154,7 @@ public final class SpawnerCreature { entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F); if (entityliving.canSpawn()) { ++j2; - // CraftBukkit start - added a reason for spawning this creature, moved a(entityliving, world...) up + // CraftBukkit start - Added a reason for spawning this creature, moved a(entityliving, world...) up a(entityliving, worldserver, f, f1, f2); worldserver.addEntity(entityliving, SpawnReason.NATURAL); // CraftBukkit end @@ -236,7 +236,7 @@ public final class SpawnerCreature { } entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F); - // CraftBukkit start - added a reason for spawning this creature, moved a(entity, world...) up + // CraftBukkit start - Added a reason for spawning this creature, moved a(entity, world...) up a(entityliving, world, f, f1, f2); world.addEntity(entityliving, SpawnReason.CHUNK_GEN); // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java index 88039bc3c1..be1145f7fe 100644 --- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java +++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java @@ -133,11 +133,11 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor if (this.l()) { ItemStack itemstack = this.items[3]; - // CraftBukkit start - fire BREW event + // CraftBukkit start if (getOwner() != null) { BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(x, y, z), (org.bukkit.inventory.BrewerInventory) this.getOwner().getInventory()); org.bukkit.Bukkit.getPluginManager().callEvent(event); - if(event.isCancelled()) { + if (event.isCancelled()) { return; } } diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java index 43e03e5e50..0f9a38f70a 100644 --- a/src/main/java/net/minecraft/server/TileEntityCommand.java +++ b/src/main/java/net/minecraft/server/TileEntityCommand.java @@ -2,7 +2,6 @@ package net.minecraft.server; // CraftBukkit start import java.util.ArrayList; -import java.util.Arrays; import com.google.common.base.Joiner; // CraftBukkit end @@ -31,7 +30,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener { MinecraftServer minecraftserver = MinecraftServer.getServer(); if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) { - // CraftBukkit start - handle command block commands using Bukkit dispatcher + // CraftBukkit start - Handle command block commands using Bukkit dispatcher org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap(); Joiner joiner = Joiner.on(" "); String command = this.b; @@ -41,19 +40,19 @@ public class TileEntityCommand extends TileEntity implements ICommandListener { String[] args = command.split(" "); ArrayList commands = new ArrayList(); - // block disallowed commands + // Block disallowed commands if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") || args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") || args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) { return 0; } - // make sure this is a valid command + // Make sure this is a valid command if (commandMap.getCommand(args[0]) == null) { return 0; } - // if the world has no players don't run + // If the world has no players don't run if (this.world.players.isEmpty()) { return 0; } @@ -80,7 +79,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener { commands.add(args); - // find positions of command block syntax, if any + // Find positions of command block syntax, if any ArrayList newCommands = new ArrayList(); for (int i = 0; i < args.length; i++) { if (PlayerSelector.isPattern(args[i])) { @@ -96,10 +95,10 @@ public class TileEntityCommand extends TileEntity implements ICommandListener { int completed = 0; - // now dispatch all of the commands we ended up with + // Now dispatch all of the commands we ended up with for (int i = 0; i < commands.size(); i++) { try { - if (commandMap.dispatch(sender, joiner.join(Arrays.asList(commands.get(i))))) { + if (commandMap.dispatch(sender, joiner.join(java.util.Arrays.asList(commands.get(i))))) { completed++; } } catch (Throwable exception) { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 9e5a2f5099..e6cd7f9e8b 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -188,7 +188,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory { } if (!this.world.isStatic) { - // CraftBukkit start - handle multiple elapsed ticks + // CraftBukkit start - Handle multiple elapsed ticks if (this.burnTime <= 0 && this.canBurn() && this.items[1] != null) { // CraftBukkit - == to <= CraftItemStack fuel = CraftItemStack.asCraftMirror(this.items[1]); @@ -215,7 +215,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory { } } - /* CraftBukkit start - moved up + /* CraftBukkit start - Moved up if (this.isBurning() && this.canBurn()) { ++this.cookTime; if (this.cookTime == 200) { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java index 94c510f836..814b1eb3f3 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -202,7 +202,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { for (int i = 0; i < this.getSize(); ++i) { if (this.getItem(i) != null) { ItemStack itemstack = this.getItem(i).cloneItemStack(); - // CraftBukkit start - fire event when pushing items into other inventories + // CraftBukkit start - Call event when pushing items into other inventories CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); Inventory destinationInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; @@ -210,7 +210,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { this.getWorld().getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { this.setItem(i, itemstack); - this.c(8); // delay hopper checks + this.c(8); // Delay hopper checks return false; } ItemStack itemstack1 = addItem(iinventory, CraftItemStack.asNMSCopy(event.getItem()), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]); @@ -273,7 +273,7 @@ public class TileEntityHopper extends TileEntity implements IHopper { if (itemstack != null && canTakeItemFromInventory(iinventory, itemstack, i, j)) { ItemStack itemstack1 = itemstack.cloneItemStack(); - // CraftBukkit start - fire event on collection of items from inventories into the hopper + // CraftBukkit start - Call event on collection of items from inventories into the hopper CraftItemStack oitemstack = CraftItemStack.asCraftMirror(iinventory.splitStack(i, 1)); Inventory sourceInventory = iinventory.getOwner() != null ? iinventory.getOwner().getInventory() : null; @@ -284,9 +284,9 @@ public class TileEntityHopper extends TileEntity implements IHopper { iinventory.setItem(i, itemstack1); if (ihopper instanceof TileEntityHopper) { - ((TileEntityHopper) ihopper).c(8); // delay hopper checks + ((TileEntityHopper) ihopper).c(8); // Delay hopper checks } else if (ihopper instanceof EntityMinecartHopper) { - ((EntityMinecartHopper) ihopper).n(4); // delay hopper minecart checks + ((EntityMinecartHopper) ihopper).n(4); // Delay hopper minecart checks } return false; diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java index 43393d9bb5..b9f00b6a11 100644 --- a/src/main/java/net/minecraft/server/TileEntitySign.java +++ b/src/main/java/net/minecraft/server/TileEntitySign.java @@ -4,7 +4,7 @@ public class TileEntitySign extends TileEntity { public String[] lines = new String[] { "", "", "", ""}; public int b = -1; - public boolean isEditable = true; // CraftBukkit - privite -> public + public boolean isEditable = true; // CraftBukkit - private -> public public TileEntitySign() {} @@ -31,7 +31,7 @@ public class TileEntitySign extends TileEntity { public Packet getUpdatePacket() { String[] astring = new String[4]; - // CraftBukkit start - limit sign text to 15 chars per line + // CraftBukkit start - Limit sign text to 15 chars per line for (int i = 0; i < 4; ++i) { astring[i] = this.lines[i]; diff --git a/src/main/java/net/minecraft/server/Vec3DPool.java b/src/main/java/net/minecraft/server/Vec3DPool.java index b99d9bd275..e29889c019 100644 --- a/src/main/java/net/minecraft/server/Vec3DPool.java +++ b/src/main/java/net/minecraft/server/Vec3DPool.java @@ -24,8 +24,8 @@ public class Vec3DPool { this.b = j; } - public final Vec3D create(double d0, double d1, double d2) { // CraftBukkit - add final - if (this.resizeTime == 0) return Vec3D.a(d0, d1, d2); // CraftBukkit - don't pool objects indefinitely if thread doesn't adhere to contract + public final Vec3D create(double d0, double d1, double d2) { // CraftBukkit - Add final + if (this.resizeTime == 0) return Vec3D.a(d0, d1, d2); // CraftBukkit - Don't pool objects indefinitely if thread doesn't adhere to contract Vec3D vec3d; if (this.freelist == null) { // CraftBukkit @@ -43,14 +43,14 @@ public class Vec3DPool { if (this.alloclist == null) { this.alloclisthead = vec3d; } - vec3d.next = this.alloclist; // add to allocated list + vec3d.next = this.alloclist; // Add to allocated list this.alloclist = vec3d; // CraftBukkit end ++this.position; return vec3d; } - // CraftBukkit start - offer back vector (can save LOTS of unneeded bloat) - works about 90% of the time + // CraftBukkit start - Offer back vector (can save LOTS of unneeded bloat) - works about 90% of the time public void release(Vec3D v) { if (this.alloclist == v) { this.alloclist = v.next; // Pop off alloc list @@ -68,7 +68,7 @@ public class Vec3DPool { this.largestSize = this.position; } - // CraftBukkit start - intelligent cache + // CraftBukkit start - Intelligent cache // Take any allocated blocks and put them on free list if (this.alloclist != null) { if (this.freelist == null) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index b6947897e2..9698185458 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -892,7 +892,7 @@ public abstract class World implements IBlockAccess { return true; } - // CraftBukkit start - used for entities other than creatures + // CraftBukkit start - Used for entities other than creatures public boolean addEntity(Entity entity) { return this.addEntity(entity, SpawnReason.DEFAULT); // Set reason as DEFAULT } @@ -1147,7 +1147,7 @@ public abstract class World implements IBlockAccess { for (i = 0; i < this.i.size(); ++i) { entity = (Entity) this.i.get(i); - // CraftBukkit start - fixed an NPE, don't process entities in chunks queued for unload + // CraftBukkit start - Fixed an NPE, don't process entities in chunks queued for unload if (entity == null) { continue; } @@ -1203,7 +1203,7 @@ public abstract class World implements IBlockAccess { for (i = 0; i < this.entityList.size(); ++i) { entity = (Entity) this.entityList.get(i); - // CraftBukkit start - don't tick entities in chunks queued for unload + // CraftBukkit start - 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; @@ -1253,7 +1253,7 @@ public abstract class World implements IBlockAccess { while (iterator.hasNext()) { TileEntity tileentity = (TileEntity) iterator.next(); - // CraftBukkit start - don't tick entities in chunks queued for unload + // CraftBukkit start - Don't tick entities in chunks queued for unload ChunkProviderServer chunkProviderServer = ((WorldServer) this).chunkProviderServer; if (chunkProviderServer.unloadQueue.contains(tileentity.x >> 4, tileentity.z >> 4)) { continue; @@ -1295,7 +1295,7 @@ public abstract class World implements IBlockAccess { TileEntity tileentity1 = (TileEntity) this.a.get(l); if (!tileentity1.r()) { - /* CraftBukkit start - order matters, moved down + /* CraftBukkit start - Order matters, moved down if (!this.tileEntityList.contains(tileentity1)) { this.tileEntityList.add(tileentity1); } @@ -1306,7 +1306,7 @@ public abstract class World implements IBlockAccess { if (chunk1 != null) { chunk1.a(tileentity1.x & 15, tileentity1.y, tileentity1.z & 15, tileentity1); - // CraftBukkit start - moved down from above + // CraftBukkit start - Moved down from above if (!this.tileEntityList.contains(tileentity1)) { this.tileEntityList.add(tileentity1); } @@ -1963,7 +1963,7 @@ public abstract class World implements IBlockAccess { for (int l = -b0; l <= b0; ++l) { for (int i1 = -b0; i1 <= b0; ++i1) { - // CraftBukkit start - don't tick chunks queued for unload + // CraftBukkit start - Don't tick chunks queued for unload ChunkProviderServer chunkProviderServer = ((WorldServer) entityhuman.world).chunkProviderServer; if (chunkProviderServer.unloadQueue.contains(l + j, i1 + k)) { continue; @@ -2517,7 +2517,7 @@ public abstract class World implements IBlockAccess { for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); - // CraftBukkit start - fixed an NPE + // CraftBukkit start - Fixed an NPE if (entityhuman1 == null || entityhuman1.dead) { continue; } @@ -2543,7 +2543,7 @@ public abstract class World implements IBlockAccess { for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); - // CraftBukkit start - fixed an NPE + // CraftBukkit start - Fixed an NPE if (entityhuman1 == null || entityhuman1.dead) { continue; } diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java index 5ec2c44842..185ea74d16 100644 --- a/src/main/java/net/minecraft/server/WorldGenBigTree.java +++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java @@ -350,7 +350,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate // sk: The idea is to have (our) WorldServer implement // BlockChangeDelegate and then we can implicitly cast World to // WorldServer (a safe cast, AFAIK) and no code will be broken. This diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java index da137e3a28..993be98edb 100644 --- a/src/main/java/net/minecraft/server/WorldGenForest.java +++ b/src/main/java/net/minecraft/server/WorldGenForest.java @@ -11,7 +11,7 @@ public class WorldGenForest extends WorldGenerator implements BlockSapling.TreeG } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java index b598d28ecc..ceb2c9fc0f 100644 --- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java +++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java @@ -15,7 +15,7 @@ public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.T } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } @@ -49,7 +49,7 @@ public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.T } } } - // CraftBukkit start - return false if gen was unsuccessful + // CraftBukkit start - Return false if gen was unsuccessful } else { return false; } diff --git a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java index 249976e435..42b1923232 100644 --- a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java +++ b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java @@ -22,7 +22,7 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return grow((BlockChangeDelegate) world, random, i, j, k, null, null, null); } diff --git a/src/main/java/net/minecraft/server/WorldGenMegaTree.java b/src/main/java/net/minecraft/server/WorldGenMegaTree.java index 957b3e47d3..6ffae2fb78 100644 --- a/src/main/java/net/minecraft/server/WorldGenMegaTree.java +++ b/src/main/java/net/minecraft/server/WorldGenMegaTree.java @@ -18,7 +18,7 @@ public class WorldGenMegaTree extends WorldGenerator implements BlockSapling.Tre } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } diff --git a/src/main/java/net/minecraft/server/WorldGenSwampTree.java b/src/main/java/net/minecraft/server/WorldGenSwampTree.java index 6f78c0abe9..853bf99de7 100644 --- a/src/main/java/net/minecraft/server/WorldGenSwampTree.java +++ b/src/main/java/net/minecraft/server/WorldGenSwampTree.java @@ -9,7 +9,7 @@ public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.Tr public WorldGenSwampTree() {} public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga1.java b/src/main/java/net/minecraft/server/WorldGenTaiga1.java index 5e75f6f8da..65eee4ef6f 100644 --- a/src/main/java/net/minecraft/server/WorldGenTaiga1.java +++ b/src/main/java/net/minecraft/server/WorldGenTaiga1.java @@ -9,7 +9,7 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG public WorldGenTaiga1() {} public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java index 79f5df80cc..52d5fbb5d2 100644 --- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java +++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java @@ -11,7 +11,7 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java index 4d8b04f233..9354c865b2 100644 --- a/src/main/java/net/minecraft/server/WorldGenTrees.java +++ b/src/main/java/net/minecraft/server/WorldGenTrees.java @@ -24,7 +24,7 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe } public boolean a(World world, Random random, int i, int j, int k) { - // CraftBukkit start - moved to generate + // CraftBukkit start - Moved to generate return this.generate((BlockChangeDelegate) world, random, i, j, k); } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index ce54462399..a49419e407 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -474,7 +474,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate throw new IllegalStateException("TickNextTick list out of synch"); } else { if (i > 1000) { - // CraftBukkit start - if the server has too much to process over time, try to alleviate that + // CraftBukkit start - If the server has too much to process over time, try to alleviate that if (i > 20 * 1000) { i = i / 20; } else { @@ -555,7 +555,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate iterator = this.M.iterator(); } else { iterator = this.T.iterator(); - /* CraftBukkit start - comment out debug spam + /* CraftBukkit start - Comment out debug spam if (!this.T.isEmpty()) { System.out.println(this.T.size()); } @@ -626,7 +626,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate public List getTileEntities(int i, int j, int k, int l, int i1, int j1) { ArrayList arraylist = new ArrayList(); - // CraftBukkit start - use iterator + // CraftBukkit start - Use iterator Iterator iterator = this.tileEntityList.iterator(); while (iterator.hasNext()) { @@ -894,7 +894,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate super.n(); if (flag != this.O()) { - // CraftBukkit start - only sending weather packets to those affected + // CraftBukkit start - Only send weather packets to those affected for (int i = 0; i < this.players.size(); ++i) { if (((EntityPlayer) this.players.get(i)).world == this) { ((EntityPlayer) this.players.get(i)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index c3b9113a6d..79c3893848 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -228,13 +228,13 @@ public class CraftChunk implements Chunk { if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; - float[] dat = wcm.getTemperatures((float[]) null, getX() << 4, getZ() << 4, 16, 16); + float[] dat = wcm.getTemperatures(null, getX() << 4, getZ() << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeTemp[i] = dat[i]; } - dat = wcm.getWetness((float[]) null, getX() << 4, getZ() << 4, 16, 16); + dat = wcm.getWetness(null, getX() << 4, getZ() << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeRain[i] = dat[i]; @@ -264,13 +264,13 @@ public class CraftChunk implements Chunk { if (includeBiomeTempRain) { biomeTemp = new double[256]; biomeRain = new double[256]; - float[] dat = wcm.getTemperatures((float[]) null, x << 4, z << 4, 16, 16); + float[] dat = wcm.getTemperatures(null, x << 4, z << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeTemp[i] = dat[i]; } - dat = wcm.getWetness((float[]) null, x << 4, z << 4, 16, 16); + dat = wcm.getWetness(null, x << 4, z << 4, 16, 16); for (int i = 0; i < 256; i++) { biomeRain[i] = dat[i]; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 6b3b9fecaa..7b9c787759 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -723,7 +723,7 @@ public final class CraftServer implements Server { internal.worldMaps = console.worlds.get(0).worldMaps; internal.tracker = new EntityTracker(internal); // CraftBukkit - internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal)); + internal.addIWorldAccess(new WorldManager(console, internal)); internal.difficulty = 1; internal.setSpawnFlags(true, true); console.worlds.add(internal); @@ -795,7 +795,7 @@ public final class CraftServer implements Server { if (save) { try { - handle.save(true, (IProgressUpdate) null); + handle.save(true, null); handle.saveLevel(); WorldSaveEvent event = new WorldSaveEvent(handle.getWorld()); getPluginManager().callEvent(event); @@ -936,12 +936,12 @@ public final class CraftServer implements Server { if (section != null) { for (String key : section.getKeys(false)) { - List commands = null; + List commands; if (section.isList(key)) { commands = section.getStringList(key); } else { - commands = ImmutableList.of(section.getString(key)); + commands = ImmutableList.of(section.getString(key)); } result.put(key, commands.toArray(new String[commands.size()])); @@ -1247,9 +1247,9 @@ public final class CraftServer implements Server { public void onPlayerJoin(Player player) { if ((updater.isEnabled()) && (updater.getCurrent() != null) && (player.hasPermission(Server.BROADCAST_CHANNEL_ADMINISTRATIVE))) { - if ((updater.getCurrent().isBroken()) && (updater.getOnBroken().contains(updater.WARN_OPERATORS))) { + if ((updater.getCurrent().isBroken()) && (updater.getOnBroken().contains(AutoUpdater.WARN_OPERATORS))) { player.sendMessage(ChatColor.DARK_RED + "The version of CraftBukkit that this server is running is known to be broken. Please consider updating to the latest version at dl.bukkit.org."); - } else if ((updater.isUpdateAvailable()) && (updater.getOnUpdate().contains(updater.WARN_OPERATORS))) { + } else if ((updater.isUpdateAvailable()) && (updater.getOnUpdate().contains(AutoUpdater.WARN_OPERATORS))) { player.sendMessage(ChatColor.DARK_PURPLE + "The version of CraftBukkit that this server is running is out of date. Please consider updating to the latest version at dl.bukkit.org."); } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java index ee30dcd1cf..1190ff13a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java @@ -6,7 +6,7 @@ import org.apache.commons.lang.Validate; import org.bukkit.Sound; public class CraftSound { - private static String[] sounds = new String[Sound.values().length]; + private static final String[] sounds = new String[Sound.values().length]; static { sounds[AMBIENCE_CAVE.ordinal()] = "ambient.cave.cave"; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 41cb825e42..b5a68af15e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -244,7 +244,7 @@ public class CraftWorld implements World { } world.chunkProviderServer.unloadQueue.remove(x, z); - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) world.chunkProviderServer.chunks.get(LongHash.toLong(x, z)); + net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z)); if (chunk == null) { chunk = world.chunkProviderServer.loadChunk(x, z); @@ -681,7 +681,7 @@ public class CraftWorld implements World { public void setStorm(boolean hasStorm) { CraftServer server = world.getServer(); - WeatherChangeEvent weather = new WeatherChangeEvent((org.bukkit.World) this, hasStorm); + WeatherChangeEvent weather = new WeatherChangeEvent(this, hasStorm); server.getPluginManager().callEvent(weather); if (!weather.isCancelled()) { world.worldData.setStorm(hasStorm); @@ -711,7 +711,7 @@ public class CraftWorld implements World { if (thundering && !hasStorm()) setStorm(true); CraftServer server = world.getServer(); - ThunderChangeEvent thunder = new ThunderChangeEvent((org.bukkit.World) this, thundering); + ThunderChangeEvent thunder = new ThunderChangeEvent(this, thundering); server.getPluginManager().callEvent(thunder); if (!thunder.isCancelled()) { world.worldData.setThundering(thundering); @@ -858,7 +858,7 @@ public class CraftWorld implements World { } else { entity = new EntityLargeFireball(world); } - ((EntityFireball) entity).setPositionRotation(x, y, z, yaw, pitch); + entity.setPositionRotation(x, y, z, yaw, pitch); Vector direction = location.getDirection().multiply(10); ((EntityFireball) entity).setDirection(direction.getX(), direction.getY(), direction.getZ()); } @@ -1265,9 +1265,7 @@ public class CraftWorld implements World { } ChunkProviderServer cps = world.chunkProviderServer; - Iterator iter = cps.chunks.values().iterator(); - while (iter.hasNext()) { - net.minecraft.server.Chunk chunk = iter.next(); + for (net.minecraft.server.Chunk chunk : cps.chunks.values()) { // If in use, skip it if (isChunkInUse(chunk.x, chunk.z)) { continue; @@ -1279,7 +1277,7 @@ public class CraftWorld implements World { } // Add unload request - cps.queueUnload(chunk.x, chunk.z); + cps.queueUnload(chunk.x, chunk.z); } } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index f1c0e4199a..2334fb625c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -340,7 +340,7 @@ public class CraftBlock implements Block { public int getBlockPower(BlockFace face) { int power = 0; - BlockRedstoneWire wire = (BlockRedstoneWire) net.minecraft.server.Block.REDSTONE_WIRE; + BlockRedstoneWire wire = net.minecraft.server.Block.REDSTONE_WIRE; net.minecraft.server.World world = chunk.getHandle().world; if ((face == BlockFace.DOWN || face == BlockFace.SELF) && world.isBlockFacePowered(x, y - 1, z, 0)) power = wire.getPower(world, x, y - 1, z, power); if ((face == BlockFace.UP || face == BlockFace.SELF) && world.isBlockFacePowered(x, y + 1, z, 1)) power = wire.getPower(world, x, y + 1, z, power); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index 0529689887..d2350452ab 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java @@ -115,19 +115,17 @@ public class CraftBlockState implements BlockState { public boolean update(boolean force) { Block block = getBlock(); - synchronized (block) { - if (block.getType() != this.getType()) { - if (force) { - block.setTypeId(this.getTypeId()); - } else { - return false; - } + if (block.getType() != this.getType()) { + if (force) { + block.setTypeId(this.getTypeId()); + } else { + return false; } - - block.setData(getRawData()); - world.getHandle().notify(x, y, z); } + block.setData(getRawData()); + world.getHandle().notify(x, y, z); + return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java index 6a697cd320..074473cd5d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBrewingStand.java @@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryBrewer; import org.bukkit.inventory.BrewerInventory; public class CraftBrewingStand extends CraftBlockState implements BrewingStand { - private final CraftWorld world; private final TileEntityBrewingStand brewingStand; public CraftBrewingStand(Block block) { super(block); - world = (CraftWorld) block.getWorld(); - brewingStand = (TileEntityBrewingStand) world.getTileEntityAt(getX(), getY(), getZ()); + brewingStand = (TileEntityBrewingStand) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ()); } public BrewerInventory getInventory() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java index 554eee9cfb..86839ad97f 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -9,14 +9,12 @@ import org.bukkit.entity.CreatureType; import org.bukkit.entity.EntityType; public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpawner { - private final CraftWorld world; private final TileEntityMobSpawner spawner; public CraftCreatureSpawner(final Block block) { super(block); - world = (CraftWorld) block.getWorld(); - spawner = (TileEntityMobSpawner) world.getTileEntityAt(getX(), getY(), getZ()); + spawner = (TileEntityMobSpawner) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ()); } @Deprecated diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java index c94b43d1d2..9561ea9bd5 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java @@ -28,15 +28,13 @@ public class CraftDispenser extends CraftBlockState implements Dispenser { public boolean dispense() { Block block = getBlock(); - synchronized (block) { - if (block.getType() == Material.DISPENSER) { - BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER; + if (block.getType() == Material.DISPENSER) { + BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER; - dispense.dispense(world.getHandle(), getX(), getY(), getZ()); - return true; - } else { - return false; - } + dispense.dispense(world.getHandle(), getX(), getY(), getZ()); + return true; + } else { + return false; } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java index ace93e0840..85b9af64c7 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDropper.java @@ -28,12 +28,10 @@ public class CraftDropper extends CraftBlockState implements Dropper { public void drop() { Block block = getBlock(); - synchronized (block) { - if (block.getType() == Material.DROPPER) { - BlockDropper drop = (BlockDropper) net.minecraft.server.Block.DROPPER; + if (block.getType() == Material.DROPPER) { + BlockDropper drop = (BlockDropper) net.minecraft.server.Block.DROPPER; - drop.dispense(world.getHandle(), getX(), getY(), getZ()); - } + drop.dispense(world.getHandle(), getX(), getY(), getZ()); } } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java index e4756dcd2b..d50604d991 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryFurnace; import org.bukkit.inventory.FurnaceInventory; public class CraftFurnace extends CraftBlockState implements Furnace { - private final CraftWorld world; private final TileEntityFurnace furnace; public CraftFurnace(final Block block) { super(block); - world = (CraftWorld) block.getWorld(); - furnace = (TileEntityFurnace) world.getTileEntityAt(getX(), getY(), getZ()); + furnace = (TileEntityFurnace) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ()); } public FurnaceInventory getInventory() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java index 6489e1536e..787b609f43 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftHopper.java @@ -8,14 +8,12 @@ import org.bukkit.craftbukkit.inventory.CraftInventory; import org.bukkit.inventory.Inventory; public class CraftHopper extends CraftBlockState implements Hopper { - private final CraftWorld world; private final TileEntityHopper hopper; public CraftHopper(final Block block) { super(block); - world = (CraftWorld) block.getWorld(); - hopper = (TileEntityHopper) world.getTileEntityAt(getX(), getY(), getZ()); + hopper = (TileEntityHopper) ((CraftWorld) block.getWorld()).getTileEntityAt(getX(), getY(), getZ()); } public Inventory getInventory() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java index 6beaa23b31..0cfddf40b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java @@ -39,39 +39,33 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { public boolean play() { Block block = getBlock(); - synchronized (block) { - if (block.getType() == Material.NOTE_BLOCK) { - note.play(world.getHandle(), getX(), getY(), getZ()); - return true; - } else { - return false; - } + if (block.getType() == Material.NOTE_BLOCK) { + note.play(world.getHandle(), getX(), getY(), getZ()); + return true; + } else { + return false; } } public boolean play(byte instrument, byte note) { Block block = getBlock(); - synchronized (block) { - if (block.getType() == Material.NOTE_BLOCK) { - world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note); - return true; - } else { - return false; - } + if (block.getType() == Material.NOTE_BLOCK) { + world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument, note); + return true; + } else { + return false; } } public boolean play(Instrument instrument, Note note) { Block block = getBlock(); - synchronized (block) { - if (block.getType() == Material.NOTE_BLOCK) { - world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId()); - return true; - } else { - return false; - } + if (block.getType() == Material.NOTE_BLOCK) { + world.getHandle().playNote(getX(), getY(), getZ(), block.getTypeId(), instrument.getType(), note.getId()); + return true; + } else { + return false; } } } diff --git a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java index 48cf5bac09..c896ba2618 100644 --- a/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java +++ b/src/main/java/org/bukkit/craftbukkit/chunkio/ChunkIOProvider.java @@ -57,7 +57,7 @@ class ChunkIOProvider implements AsynchronousExecutor.CallBackProvider replacements = new EnumMap(ChatColor.class); private final ChatColor[] colors = ChatColor.values(); protected ColouredConsoleSender() { super(); - this.reader = ((CraftServer) getServer()).getReader(); - this.terminal = reader.getTerminal(); + this.terminal = ((CraftServer) getServer()).getReader().getTerminal(); replacements.put(ChatColor.BLACK, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLACK).boldOff().toString()); replacements.put(ChatColor.DARK_BLUE, Ansi.ansi().a(Attribute.RESET).fg(Ansi.Color.BLUE).boldOff().toString()); diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java index 1ccbbf01dd..832acd84c2 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java @@ -22,9 +22,6 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc public void sendMessage(String message) { } - public void sendRawMessage(String message) { - } - public void sendMessage(String[] messages) { } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java index b2e7ca5ff0..9abcf92db3 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftConsoleCommandSender.java @@ -21,7 +21,7 @@ public class CraftConsoleCommandSender extends ServerCommandSender implements Co public void sendMessage(String message) { sendRawMessage(message); } - + public void sendRawMessage(String message) { System.out.println(ChatColor.stripColor(message)); } diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java index d4b04712f5..fec7feebde 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java +++ b/src/main/java/org/bukkit/craftbukkit/command/CraftRemoteConsoleCommandSender.java @@ -11,7 +11,7 @@ public class CraftRemoteConsoleCommandSender extends ServerCommandSender impleme public void sendMessage(String message) { RemoteControlCommandListener.instance.sendMessage(message + "\n"); // Send a newline after each message, to preserve formatting. } - + public void sendMessage(String[] messages) { for (String message : messages) { sendMessage(message); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java index ecd630c591..ce49700182 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAgeable.java @@ -54,12 +54,12 @@ public class CraftAgeable extends CraftCreature implements Ageable { setAge(6000); } } - + @Override public EntityAgeable getHandle() { return (EntityAgeable) entity; } - + @Override public String toString() { return "CraftAgeable"; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index d0510aff44..97f3c1d5e6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -187,7 +187,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public World getWorld() { - return ((WorldServer) entity.world).getWorld(); + return entity.world.getWorld(); } public boolean teleport(Location location) { @@ -265,7 +265,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public org.bukkit.entity.Entity getPassenger() { - return isEmpty() ? null : (CraftEntity) getHandle().passenger.getBukkitEntity(); + return isEmpty() ? null : getHandle().passenger.getBukkitEntity(); } public boolean setPassenger(org.bukkit.entity.Entity passenger) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java index 58c28b380d..1e432ca0cd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFish.java @@ -15,7 +15,7 @@ public class CraftFish extends AbstractProjectile implements Fish { public LivingEntity getShooter() { if (getHandle().owner != null) { - return (LivingEntity) getHandle().owner.getBukkitEntity(); + return getHandle().owner.getBukkitEntity(); } return null; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 70111e7a63..d37d719a80 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -366,7 +366,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // To = Players new Location if Teleport is Successful Location to = location; // Create & Call the Teleport Event. - PlayerTeleportEvent event = new PlayerTeleportEvent((Player) this, from, to, cause); + PlayerTeleportEvent event = new PlayerTeleportEvent(this, from, to, cause); server.getPluginManager().callEvent(event); // Return False to inform the Plugin that the Teleport was unsuccessful/cancelled. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java index cd5e5932fb..b60d97b107 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftProjectile.java @@ -12,7 +12,7 @@ public abstract class CraftProjectile extends AbstractProjectile implements Proj } public LivingEntity getShooter() { - if (getHandle().getShooter() instanceof EntityLiving) { + if (getHandle().getShooter() != null) { return (LivingEntity) getHandle().getShooter().getBukkitEntity(); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 4ea9c0c3cd..349423271a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -76,7 +76,7 @@ public class CraftEventFactory { ChunkCoordinates chunkcoordinates = worldServer.getSpawn(); - int distanceFromSpawn = (int) Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z)); + int distanceFromSpawn = Math.max(Math.abs(x - chunkcoordinates.x), Math.abs(z - chunkcoordinates.z)); return distanceFromSpawn >= spawnSize; } @@ -89,8 +89,8 @@ public class CraftEventFactory { * Block place methods */ public static BlockPlaceEvent callBlockPlaceEvent(World world, EntityHuman who, BlockState replacedBlockState, int clickedX, int clickedY, int clickedZ) { - CraftWorld craftWorld = ((WorldServer) world).getWorld(); - CraftServer craftServer = ((WorldServer) world).getServer(); + CraftWorld craftWorld = world.getWorld(); + CraftServer craftServer = world.getServer(); Player player = (who == null) ? null : (Player) who.getBukkitEntity(); @@ -236,7 +236,7 @@ public class CraftEventFactory { */ public static EntityTameEvent callEntityTameEvent(EntityLiving entity, EntityHuman tamer) { org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity(); - org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? (AnimalTamer) tamer.getBukkitEntity() : null); + org.bukkit.entity.AnimalTamer bukkitTamer = (tamer != null ? tamer.getBukkitEntity() : null); CraftServer craftServer = (CraftServer) bukkitEntity.getServer(); entity.persistent = true; @@ -267,7 +267,7 @@ public class CraftEventFactory { ItemDespawnEvent event = new ItemDespawnEvent(entity, entity.getLocation()); - ((CraftServer) entity.getServer()).getPluginManager().callEvent(event); + entity.getServer().getPluginManager().callEvent(event); return event; } @@ -329,7 +329,7 @@ public class CraftEventFactory { } public static PlayerDeathEvent callPlayerDeathEvent(EntityPlayer victim, List drops, String deathMessage) { - CraftPlayer entity = (CraftPlayer) victim.getBukkitEntity(); + CraftPlayer entity = victim.getBukkitEntity(); PlayerDeathEvent event = new PlayerDeathEvent(entity, drops, victim.getExpReward(), 0, deathMessage); org.bukkit.World world = entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); @@ -433,7 +433,7 @@ public class CraftEventFactory { } public static FoodLevelChangeEvent callFoodLevelChangeEvent(EntityHuman entity, int level) { - FoodLevelChangeEvent event = new FoodLevelChangeEvent((Player) entity.getBukkitEntity(), level); + FoodLevelChangeEvent event = new FoodLevelChangeEvent(entity.getBukkitEntity(), level); entity.getBukkitEntity().getServer().getPluginManager().callEvent(event); return event; } @@ -498,8 +498,8 @@ public class CraftEventFactory { player.playerConnection.handleContainerClose(new Packet101CloseWindow(player.activeContainer.windowId)); } - CraftServer server = ((WorldServer) player.world).getServer(); - CraftPlayer craftPlayer = (CraftPlayer) player.getBukkitEntity(); + CraftServer server = player.world.getServer(); + CraftPlayer craftPlayer = player.getBukkitEntity(); player.activeContainer.transferTo(container, craftPlayer); InventoryOpenEvent event = new InventoryOpenEvent(container.getBukkitView()); diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index 36aa6f8298..11e79f54e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -72,7 +72,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { continue; } byte[] secBlkID = new byte[4096]; // Allocate blk ID bytes - byte[] secExtBlkID = (byte[]) null; // Delay getting extended ID nibbles + byte[] secExtBlkID = null; // Delay getting extended ID nibbles short[] bdata = xbtypes[sec]; // Loop through data, 2 blocks at a time for (int i = 0, j = 0; i < bdata.length; i += 2, j++) { @@ -124,7 +124,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { // Loop through sections for (int sec = 0; sec < scnt; sec++) { ChunkSection cs = null; // Add sections when needed - byte[] csbytes = (byte[]) null; + byte[] csbytes = null; for (int cy = 0; cy < 16; cy++) { int cyoff = cy | (sec << 4); diff --git a/src/main/java/org/bukkit/craftbukkit/help/CommandAliasHelpTopic.java b/src/main/java/org/bukkit/craftbukkit/help/CommandAliasHelpTopic.java index 4dcfef1cef..9f2238c9a7 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/CommandAliasHelpTopic.java +++ b/src/main/java/org/bukkit/craftbukkit/help/CommandAliasHelpTopic.java @@ -8,8 +8,8 @@ import org.bukkit.help.HelpTopic; public class CommandAliasHelpTopic extends HelpTopic { - private String aliasFor; - private HelpMap helpMap; + private final String aliasFor; + private final HelpMap helpMap; public CommandAliasHelpTopic(String alias, String aliasFor, HelpMap helpMap) { this.aliasFor = aliasFor.startsWith("/") ? aliasFor : "/" + aliasFor; diff --git a/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java b/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java index 8431b5111f..6dee2296f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java +++ b/src/main/java/org/bukkit/craftbukkit/help/CustomHelpTopic.java @@ -8,16 +8,15 @@ import org.bukkit.help.HelpTopic; * This is a help topic implementation for general topics registered in the help.yml file. */ public class CustomHelpTopic extends HelpTopic { - private final String permissionNode; - + public CustomHelpTopic(String name, String shortText, String fullText, String permissionNode) { this.permissionNode = permissionNode; this.name = name; this.shortText = shortText; this.fullText = shortText + "\n" + fullText; } - + public boolean canSee(CommandSender sender) { if (sender instanceof ConsoleCommandSender) { return true; diff --git a/src/main/java/org/bukkit/craftbukkit/help/CustomIndexHelpTopic.java b/src/main/java/org/bukkit/craftbukkit/help/CustomIndexHelpTopic.java index 538f9b11b4..2089a5f524 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/CustomIndexHelpTopic.java +++ b/src/main/java/org/bukkit/craftbukkit/help/CustomIndexHelpTopic.java @@ -14,7 +14,7 @@ import java.util.List; public class CustomIndexHelpTopic extends IndexHelpTopic { private List futureTopics; private final HelpMap helpMap; - + public CustomIndexHelpTopic(HelpMap helpMap, String name, String shortText, String permission, List futureTopics, String preamble) { super(name, shortText, permission, new HashSet(), preamble); this.helpMap = helpMap; @@ -34,7 +34,7 @@ public class CustomIndexHelpTopic extends IndexHelpTopic { setTopicsCollection(topics); futureTopics = null; } - + return super.getFullText(sender); } } diff --git a/src/main/java/org/bukkit/craftbukkit/help/HelpTopicAmendment.java b/src/main/java/org/bukkit/craftbukkit/help/HelpTopicAmendment.java index 922a3e9a94..4f0e00ec7e 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/HelpTopicAmendment.java +++ b/src/main/java/org/bukkit/craftbukkit/help/HelpTopicAmendment.java @@ -4,10 +4,10 @@ package org.bukkit.craftbukkit.help; * A HelpTopicAmendment represents the contents of a topic amendment from the help.yml */ public class HelpTopicAmendment { - private String topicName; - private String shortText; - private String fullText; - private String permission; + private final String topicName; + private final String shortText; + private final String fullText; + private final String permission; public HelpTopicAmendment(String topicName, String shortText, String fullText, String permission) { this.fullText = fullText; diff --git a/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java b/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java index bd21c233d6..6f4b22b99a 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java +++ b/src/main/java/org/bukkit/craftbukkit/help/MultipleCommandAliasHelpTopic.java @@ -12,7 +12,7 @@ import org.bukkit.help.HelpTopic; */ public class MultipleCommandAliasHelpTopic extends HelpTopic { - private MultipleCommandAlias alias; + private final MultipleCommandAlias alias; public MultipleCommandAliasHelpTopic(MultipleCommandAlias alias) { this.alias = alias; diff --git a/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java b/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java index d286b1c23d..27f9ce9d54 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java +++ b/src/main/java/org/bukkit/craftbukkit/help/SimpleHelpMap.java @@ -145,7 +145,7 @@ public class SimpleHelpMap implements HelpMap { } // Add alias sub-index - Collection filteredTopics = Collections2.filter(helpTopics.values(), Predicates.instanceOf(CommandAliasHelpTopic.class)); + Collection filteredTopics = Collections2.filter(helpTopics.values(), Predicates.instanceOf(CommandAliasHelpTopic.class)); if (!filteredTopics.isEmpty()) { addTopic(new IndexHelpTopic("Aliases", "Lists command aliases", null, filteredTopics)); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 9231bf70c4..31a2907242 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -27,7 +27,7 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.Material; public class CraftInventory implements Inventory { - protected IInventory inventory; + protected final IInventory inventory; public CraftInventory(IInventory inventory) { this.inventory = inventory; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java index 757c9d44e7..612a630d4a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaEnchantedBook.java @@ -127,7 +127,7 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage } public boolean hasStoredEnchant(Enchantment ench) { - return hasStoredEnchants() ? enchantments.containsKey(ench) : false; + return hasStoredEnchants() && enchantments.containsKey(ench); } public int getStoredEnchantLevel(Enchantment ench) { @@ -155,7 +155,7 @@ class CraftMetaEnchantedBook extends CraftMetaItem implements EnchantmentStorage } public boolean removeStoredEnchant(Enchantment ench) { - return hasStoredEnchants() ? enchantments.remove(ench) != null : false; + return hasStoredEnchants() && enchantments.remove(ench) != null; } public boolean hasStoredEnchants() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 519d900e08..30916f9946 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -303,8 +303,8 @@ class CraftMetaItem implements ItemMeta, Repairable { } NBTTagList tagList = new NBTTagList(key.NBT); - for (int i = 0; i < list.size(); i++) { - tagList.add(new NBTTagString("", list.get(i))); + for (String value : list) { + tagList.add(new NBTTagString("", value)); } return tagList; @@ -370,7 +370,7 @@ class CraftMetaItem implements ItemMeta, Repairable { } public boolean hasEnchant(Enchantment ench) { - return hasEnchants() ? enchantments.containsKey(ench) : false; + return hasEnchants() && enchantments.containsKey(ench); } public int getEnchantLevel(Enchantment ench) { @@ -398,7 +398,7 @@ class CraftMetaItem implements ItemMeta, Repairable { } public boolean removeEnchant(Enchantment ench) { - return hasEnchants() ? enchantments.remove(ench) != null : false; + return hasEnchants() && enchantments.remove(ench) != null; } public boolean hasEnchants() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java index 0f416a88fc..4e2e393187 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java @@ -11,11 +11,11 @@ import org.bukkit.inventory.ShapedRecipe; public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe { // TODO: Could eventually use this to add a matches() method or some such private ShapedRecipes recipe; - + public CraftShapedRecipe(ItemStack result) { super(result); } - + public CraftShapedRecipe(ItemStack result, ShapedRecipes recipe) { this(result); this.recipe = recipe; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java index f8e864e46f..52c9ba9b2e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/RecipeIterator.java @@ -10,8 +10,8 @@ import net.minecraft.server.IRecipe; import net.minecraft.server.RecipesFurnace; public class RecipeIterator implements Iterator { - private Iterator recipes; - private Iterator smelting; + private final Iterator recipes; + private final Iterator smelting; private Iterator removeFrom = null; public RecipeIterator() { @@ -35,8 +35,8 @@ public class RecipeIterator implements Iterator { removeFrom = smelting; int id = smelting.next(); CraftItemStack stack = CraftItemStack.asCraftMirror(RecipesFurnace.getInstance().getResult(id)); - CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1)); - return recipe; + + return new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1)); } } diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java index 81abeb5593..22e0053550 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java +++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java @@ -42,7 +42,7 @@ public class CraftMapRenderer extends MapRenderer { } WorldMapDecoration decoration = (WorldMapDecoration) worldMap.g.get(key); - cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), (byte) (decoration.type)); + cursors.addCursor(decoration.locX, decoration.locY, (byte) (decoration.rotation & 15), decoration.type); } } diff --git a/src/main/java/org/bukkit/craftbukkit/metadata/BlockMetadataStore.java b/src/main/java/org/bukkit/craftbukkit/metadata/BlockMetadataStore.java index 5b484d0d56..6f7102f268 100644 --- a/src/main/java/org/bukkit/craftbukkit/metadata/BlockMetadataStore.java +++ b/src/main/java/org/bukkit/craftbukkit/metadata/BlockMetadataStore.java @@ -14,7 +14,7 @@ import java.util.List; */ public class BlockMetadataStore extends MetadataStoreBase implements MetadataStore { - private World owningWorld; + private final World owningWorld; /** * Initializes a BlockMetadataStore. diff --git a/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java b/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java index f0279008c9..8a1024e5ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java +++ b/src/main/java/org/bukkit/craftbukkit/updater/BukkitDLUpdaterService.java @@ -77,9 +77,8 @@ public class BukkitDLUpdaterService { connection.setRequestProperty("User-Agent", getUserAgent()); reader = new InputStreamReader(connection.getInputStream()); Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, dateDeserializer).setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); - ArtifactDetails.ChannelDetails fromJson = gson.fromJson(reader, ArtifactDetails.ChannelDetails.class); - return fromJson; + return gson.fromJson(reader, ArtifactDetails.ChannelDetails.class); } finally { if (reader != null) { reader.close();