From 9adc03abab01da7a419522990d8807ef27dafb8f Mon Sep 17 00:00:00 2001 From: Erik Broes Date: Sun, 12 Jun 2011 01:12:43 +0200 Subject: [PATCH] Generic cleanup of the org.bukkit.craftbukkit classes. --- .../org/bukkit/craftbukkit/CraftChunk.java | 4 +- .../org/bukkit/craftbukkit/CraftServer.java | 21 +++---- .../org/bukkit/craftbukkit/CraftWorld.java | 24 +++---- .../java/org/bukkit/craftbukkit/TrigMath.java | 3 +- .../bukkit/craftbukkit/block/CraftBlock.java | 2 +- .../craftbukkit/block/CraftBlockState.java | 6 +- .../bukkit/craftbukkit/block/CraftChest.java | 4 +- .../block/CraftCreatureSpawner.java | 4 +- .../craftbukkit/block/CraftDispenser.java | 7 ++- .../craftbukkit/block/CraftFurnace.java | 8 +-- .../craftbukkit/block/CraftNoteBlock.java | 4 +- .../bukkit/craftbukkit/block/CraftSign.java | 4 +- .../command/ServerCommandListener.java | 6 +- .../craftbukkit/entity/CraftChicken.java | 3 +- .../craftbukkit/entity/CraftCreature.java | 2 +- .../craftbukkit/entity/CraftCreeper.java | 4 +- .../craftbukkit/entity/CraftEntity.java | 13 ++-- .../craftbukkit/entity/CraftHumanEntity.java | 2 +- .../entity/CraftLightningStrike.java | 2 +- .../craftbukkit/entity/CraftLivingEntity.java | 15 +++-- .../craftbukkit/entity/CraftPlayer.java | 11 ++-- .../craftbukkit/entity/CraftWeather.java | 2 +- .../craftbukkit/entity/CraftZombie.java | 3 +- .../craftbukkit/event/CraftEventFactory.java | 2 +- .../generator/CustomChunkGenerator.java | 4 +- .../generator/NormalChunkGenerator.java | 2 +- .../craftbukkit/inventory/CraftInventory.java | 2 +- .../inventory/CraftInventoryPlayer.java | 23 +++---- .../craftbukkit/scheduler/CraftFuture.java | 18 +++--- .../craftbukkit/scheduler/CraftScheduler.java | 27 ++++---- .../craftbukkit/scheduler/CraftTask.java | 4 +- .../craftbukkit/util/ConcurrentSoftMap.java | 63 ++++++++++--------- .../craftbukkit/util/LongHashtable.java | 4 +- .../util/ShortConsoleLogFormatter.java | 2 +- 34 files changed, 160 insertions(+), 145 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index ad0b5c8ca3..7e92056c85 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -35,7 +35,7 @@ public class CraftChunk implements Chunk { public net.minecraft.server.Chunk getHandle() { net.minecraft.server.Chunk c = weakChunk.get(); if (c == null) { - c = worldServer.getChunkAt(x,z); + c = worldServer.getChunkAt(x, z); weakChunk = new WeakReference(c); } return c; @@ -64,7 +64,7 @@ public class CraftChunk implements Chunk { if (block == null) { Block newBlock = new CraftBlock(this, (getX() << 4) | (x & 0xF), y & 0x7F, (getZ() << 4) | (z & 0xF)); Block oldBlock = this.cache.put(pos, newBlock); - if(oldBlock == null) { + if (oldBlock == null) { block = newBlock; } else { block = oldBlock; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 77e2d836b2..e2569fba60 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -68,7 +68,7 @@ public final class CraftServer implements Server { private final String protocolVersion = "1.6.6"; private final PluginManager pluginManager = new SimplePluginManager(this); private final ServicesManager servicesManager = new SimpleServicesManager(); - private final BukkitScheduler scheduler = new CraftScheduler(this); + private final BukkitScheduler scheduler = new CraftScheduler(this); private final CommandMap commandMap = new SimpleCommandMap(this); protected final MinecraftServer console; protected final ServerConfigurationManager server; @@ -84,7 +84,7 @@ public final class CraftServer implements Server { Logger.getLogger("Minecraft").log(Level.INFO, "This server is running " + getName() + " version " + getVersion()); - configuration = new Configuration((File)console.options.valueOf("bukkit-settings")); + configuration = new Configuration((File) console.options.valueOf("bukkit-settings")); configuration.load(); loadConfigDefaults(); configuration.save(); @@ -102,7 +102,7 @@ public final class CraftServer implements Server { public void loadPlugins() { pluginManager.registerInterface(JavaPluginLoader.class); - File pluginFolder = (File)console.options.valueOf("plugins"); + File pluginFolder = (File) console.options.valueOf("plugins"); if (pluginFolder.exists()) { try { @@ -293,7 +293,7 @@ public final class CraftServer implements Server { } // See if the server can process this command - return console.consoleCommandHandler.handle(new ServerCommand(commandLine, (ICommandListener)new ServerCommandListener(sender))); + return console.consoleCommandHandler.handle(new ServerCommand(commandLine, (ICommandListener) new ServerCommandListener(sender))); } public void reload() { @@ -320,16 +320,15 @@ public final class CraftServer implements Server { int pollCount = 0; // Wait for at most 2.5 seconds for plugins to close their threads - while(pollCount < 50 && getScheduler().getActiveWorkers().size() > 0) { + while (pollCount < 50 && getScheduler().getActiveWorkers().size() > 0) { try { Thread.sleep(50); - } catch (InterruptedException e) { - } + } catch (InterruptedException e) {} pollCount++; } List overdueWorkers = getScheduler().getActiveWorkers(); - for(BukkitWorker worker : overdueWorkers) { + for (BukkitWorker worker : overdueWorkers) { Plugin plugin = worker.getOwner(); String author = ""; if (plugin.getDescription().getAuthors().size() > 0) { @@ -385,7 +384,7 @@ public final class CraftServer implements Server { internal.z = console.worlds.get(0).z; internal.tracker = new EntityTracker(console, dimension); - internal.addIWorldAccess((IWorldAccess)new WorldManager(console, internal)); + internal.addIWorldAccess((IWorldAccess) new WorldManager(console, internal)); internal.spawnMonsters = 1; internal.setSpawnFlags(true, true); console.worlds.add(internal); @@ -492,7 +491,7 @@ public final class CraftServer implements Server { Command command = commandMap.getCommand(name); if (command instanceof PluginCommand) { - return (PluginCommand)command; + return (PluginCommand) command; } else { return null; } @@ -520,7 +519,7 @@ public final class CraftServer implements Server { public boolean addRecipe(Recipe recipe) { CraftRecipe toAdd; - if(recipe instanceof CraftRecipe) { + if (recipe instanceof CraftRecipe) { toAdd = (CraftRecipe) recipe; } else { if (recipe instanceof ShapedRecipe) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index bc2b3fdb3f..138964fa03 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -32,7 +32,7 @@ public class CraftWorld implements World { private Environment environment; private final CraftServer server; private final ChunkProviderServer provider; - private HashMap unloadedChunks = new HashMap(); + private HashMap unloadedChunks = new HashMap(); private final ChunkGenerator generator; private final List populators = new ArrayList(); @@ -91,7 +91,7 @@ public class CraftWorld implements World { } public Chunk getChunkAt(int x, int z) { - return this.provider.getChunkAt(x,z).bukkitChunk; + return this.provider.getChunkAt(x, z).bukkitChunk; } public Chunk getChunkAt(Block block) { @@ -107,7 +107,7 @@ public class CraftWorld implements World { org.bukkit.Chunk[] craftChunks = new CraftChunk[chunks.length]; for (int i = 0; i < chunks.length; i++) { - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk)chunks[i]; + net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) chunks[i]; craftChunks[i] = chunk.bukkitChunk; } @@ -186,18 +186,18 @@ public class CraftWorld implements World { return false; } - int px = x<<4; - int pz = z<<4; + int px = x << 4; + int pz = z << 4; // If there are more than 10 updates to a chunk at once, it carries out the update as a cuboid // This flags 16 blocks in a line along the bottom for update and then flags a block at the opposite corner at the top // The cuboid that contains these 17 blocks covers the entire chunk // The server will compress the chunk and send it to all clients - for(int xx = px; xx < (px + 16); xx++) { + for (int xx = px; xx < (px + 16); xx++) { world.notify(xx, 0, pz); } - world.notify(px, 127, pz+15); + world.notify(px, 127, pz + 15); return true; } @@ -526,7 +526,7 @@ public class CraftWorld implements World { for (Object o: world.entityList) { if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; + net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null @@ -544,12 +544,12 @@ public class CraftWorld implements World { for (Object o: world.entityList) { if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; + net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null if (bukkitEntity != null && bukkitEntity instanceof LivingEntity) { - list.add((LivingEntity)bukkitEntity); + list.add((LivingEntity) bukkitEntity); } } } @@ -562,11 +562,11 @@ public class CraftWorld implements World { for (Object o : world.entityList) { if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity)o; + net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; Entity bukkitEntity = mcEnt.getBukkitEntity(); if ((bukkitEntity != null) && (bukkitEntity instanceof Player)) { - list.add((Player)bukkitEntity); + list.add((Player) bukkitEntity); } } } diff --git a/src/main/java/org/bukkit/craftbukkit/TrigMath.java b/src/main/java/org/bukkit/craftbukkit/TrigMath.java index 2a623bf0f7..8e7147a2bd 100644 --- a/src/main/java/org/bukkit/craftbukkit/TrigMath.java +++ b/src/main/java/org/bukkit/craftbukkit/TrigMath.java @@ -22,8 +22,9 @@ public class TrigMath { private static double mxatan(double arg) { double argsq = arg * arg, value; + value = ((((p4 * argsq + p3) * argsq + p2) * argsq + p1) * argsq + p0); - value = value / (((((argsq+q4)*argsq+q3)*argsq+q2)*argsq+q1)*argsq+q0); + value = value / (((((argsq + q4) * argsq + q3) * argsq + q2) * argsq + q1) * argsq + q0); return value * arg; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index ce1c79741d..b725f278fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -39,7 +39,7 @@ public class CraftBlock implements Block { * @return Location of the block */ public Location getLocation() { - return new Location(getWorld(), x, y, z); + return new Location(getWorld(), x, y, z); } public BlockVector getVector() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java index 1678bbf8e5..9d5f05e3b4 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java @@ -23,13 +23,13 @@ public class CraftBlockState implements BlockState { protected byte light; public CraftBlockState(final Block block) { - this.world = (CraftWorld)block.getWorld(); + this.world = (CraftWorld) block.getWorld(); this.x = block.getX(); this.y = block.getY(); this.z = block.getZ(); this.type = block.getTypeId(); this.light = block.getLightLevel(); - this.chunk = (CraftChunk)block.getChunk(); + this.chunk = (CraftChunk) block.getChunk(); createData(block.getData()); } @@ -129,7 +129,7 @@ public class CraftBlockState implements BlockState { public boolean setTypeId(final int type) { this.type = type; - createData((byte)0); + createData((byte) 0); return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java index 42c2d6e1a5..ab72c12acf 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -19,8 +19,8 @@ public class CraftChest extends CraftBlockState implements Chest { public CraftChest(final Block block) { super(block); - world = (CraftWorld)block.getWorld(); - chest = (TileEntityChest)world.getTileEntityAt(getX(), getY(), getZ()); + world = (CraftWorld) block.getWorld(); + chest = (TileEntityChest) world.getTileEntityAt(getX(), getY(), getZ()); } public Inventory getInventory() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java index 9af5f12f54..2960e6f67a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -13,8 +13,8 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa public CraftCreatureSpawner(final Block block) { super(block); - world = (CraftWorld)block.getWorld(); - spawner = (TileEntityMobSpawner)world.getTileEntityAt(getX(), getY(), getZ()); + world = (CraftWorld) block.getWorld(); + spawner = (TileEntityMobSpawner) world.getTileEntityAt(getX(), getY(), getZ()); } public CreatureType getCreatureType() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java index 4a6410a56f..3edacfc459 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftDispenser.java @@ -22,8 +22,8 @@ public class CraftDispenser extends CraftBlockState implements Dispenser { public CraftDispenser(final Block block) { super(block); - world = (CraftWorld)block.getWorld(); - dispenser = (TileEntityDispenser)world.getTileEntityAt(getX(), getY(), getZ()); + world = (CraftWorld) block.getWorld(); + dispenser = (TileEntityDispenser) world.getTileEntityAt(getX(), getY(), getZ()); } public Inventory getInventory() { @@ -35,7 +35,8 @@ public class CraftDispenser extends CraftBlockState implements Dispenser { synchronized (block) { if (block.getType() == Material.DISPENSER) { - BlockDispenser dispense = (BlockDispenser)net.minecraft.server.Block.DISPENSER; + BlockDispenser dispense = (BlockDispenser) net.minecraft.server.Block.DISPENSER; + dispense.dispense(world.getHandle(), getX(), getY(), getZ(), new Random()); return true; } else { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java index 5b1fe8aa5c..eabb22f14a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -19,8 +19,8 @@ public class CraftFurnace extends CraftBlockState implements Furnace { public CraftFurnace(final Block block) { super(block); - world = (CraftWorld)block.getWorld(); - furnace = (TileEntityFurnace)world.getTileEntityAt(getX(), getY(), getZ()); + world = (CraftWorld) block.getWorld(); + furnace = (TileEntityFurnace) world.getTileEntityAt(getX(), getY(), getZ()); } public Inventory getInventory() { @@ -39,7 +39,7 @@ public class CraftFurnace extends CraftBlockState implements Furnace { } public short getBurnTime() { - return (short)furnace.burnTime; + return (short) furnace.burnTime; } public void setBurnTime(short burnTime) { @@ -47,7 +47,7 @@ public class CraftFurnace extends CraftBlockState implements Furnace { } public short getCookTime() { - return (short)furnace.cookTime; + return (short) furnace.cookTime; } public void setCookTime(short cookTime) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java index cbc153bedf..055c74fdc3 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftNoteBlock.java @@ -18,8 +18,8 @@ public class CraftNoteBlock extends CraftBlockState implements NoteBlock { public CraftNoteBlock(final Block block) { super(block); - world = (CraftWorld)block.getWorld(); - note = (TileEntityNote)world.getTileEntityAt(getX(), getY(), getZ()); + world = (CraftWorld) block.getWorld(); + note = (TileEntityNote) world.getTileEntityAt(getX(), getY(), getZ()); } public byte getNote() { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java index c3e9d238bf..4923887147 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java @@ -12,8 +12,8 @@ public class CraftSign extends CraftBlockState implements Sign { public CraftSign(final Block block) { super(block); - world = (CraftWorld)block.getWorld(); - sign = (TileEntitySign)world.getTileEntityAt(getX(), getY(), getZ()); + world = (CraftWorld) block.getWorld(); + sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ()); } public String[] getLines() { diff --git a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java index f8d38d6a1f..4fb3123092 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java +++ b/src/main/java/org/bukkit/craftbukkit/command/ServerCommandListener.java @@ -26,10 +26,10 @@ public class ServerCommandListener implements ICommandListener { public String getName() { try { - Method getName = commandSender.getClass().getMethod( "getName" ); + Method getName = commandSender.getClass().getMethod("getName"); + return (String) getName.invoke(commandSender); - } catch (Exception e) { - } + } catch (Exception e) {} return this.prefix; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java index d42db985c9..c6e53f8d9d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftChicken.java @@ -4,7 +4,8 @@ import net.minecraft.server.EntityChicken; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Chicken; -public class CraftChicken extends CraftAnimals implements Chicken{ + +public class CraftChicken extends CraftAnimals implements Chicken { public CraftChicken(CraftServer server, EntityChicken entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index 7066de5838..e4f263634a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -6,7 +6,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Creature; import org.bukkit.entity.LivingEntity; -public class CraftCreature extends CraftLivingEntity implements Creature{ +public class CraftCreature extends CraftLivingEntity implements Creature { public CraftCreature(CraftServer server, EntityCreature entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java index 5cf0c5b3ba..27993aa07c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -32,14 +32,14 @@ public class CraftCreeper extends CraftMonster implements Creeper { server.getPluginManager().callEvent(event); if (!event.isCancelled()) { - getHandle().Z().b(17, (byte)1); + getHandle().Z().b(17, (byte) 1); } } else { CreeperPowerEvent event = new CreeperPowerEvent(entity, CreeperPowerEvent.PowerCause.SET_OFF); server.getPluginManager().callEvent(event); if (!event.isCancelled()) { - getHandle().Z().b(17, (byte)0); + getHandle().Z().b(17, (byte) 0); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 6f74777083..f4b0c4b678 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -118,11 +118,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public World getWorld() { - return ((WorldServer)entity.world).getWorld(); + return ((WorldServer) entity.world).getWorld(); } public boolean teleport(Location location) { - entity.world = ((CraftWorld)location.getWorld()).getHandle(); + entity.world = ((CraftWorld) location.getWorld()).getHandle(); entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); // entity.setLocation() throws no event, and so cannot be cancelled return true; @@ -140,10 +140,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { teleport(destination); } - public List getNearbyEntities(double x, double y, double z){ - List notchEntityList = entity.world.b(entity, entity.boundingBox.b(x,y,z)); + public List getNearbyEntities(double x, double y, double z) { + List notchEntityList = entity.world.b(entity, entity.boundingBox.b(x, y, z)); List bukkitEntityList = new java.util.ArrayList(notchEntityList.size()); - for (Entity e: notchEntityList){ + + for (Entity e: notchEntityList) { bukkitEntityList.add(e.getBukkitEntity()); } return bukkitEntityList; @@ -229,7 +230,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public boolean setPassenger(org.bukkit.entity.Entity passenger) { - if (passenger instanceof CraftEntity){ + if (passenger instanceof CraftEntity) { ((CraftEntity) passenger).getHandle().setPassengerOf(getHandle()); return true; } else { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 27b7aee3e7..04723c3542 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -26,7 +26,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { } public void setHandle(final EntityHuman entity) { - super.setHandle((EntityHuman)entity); + super.setHandle((EntityHuman) entity); this.entity = entity; this.inventory = new CraftInventoryPlayer(entity.inventory); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java index 3c595a2a76..31ffb02d3a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -12,7 +12,7 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike @Override public EntityWeatherStorm getHandle() { - return (EntityWeatherStorm)super.getHandle(); + return (EntityWeatherStorm) super.getHandle(); } public boolean isEffect() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 8e736c2c67..f377a7bf4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -40,7 +40,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } if (entity instanceof EntityPlayer && health == 0) { - ((EntityPlayer)entity).a((Entity)null); + ((EntityPlayer) entity).a((Entity) null); } getHandle().health = health; @@ -52,7 +52,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public void setHandle(final EntityLiving entity) { - super.setHandle((Entity)entity); + super.setHandle((Entity) entity); this.entity = entity; } @@ -62,15 +62,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public Egg throwEgg() { - net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); + net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); EntityEgg egg = new EntityEgg(world, getHandle()); + world.addEntity(egg); return (Egg) egg.getBukkitEntity(); } public Snowball throwSnowball() { - net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); + net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); EntitySnowball snowball = new EntitySnowball(world, getHandle()); + world.addEntity(snowball); return (Snowball) snowball.getBukkitEntity(); } @@ -101,7 +103,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { break; } } else { - if (!transparent.contains((byte)id)) { + if (!transparent.contains((byte) id)) { break; } } @@ -123,8 +125,9 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } public Arrow shootArrow() { - net.minecraft.server.World world = ((CraftWorld)getWorld()).getHandle(); + net.minecraft.server.World world = ((CraftWorld) getWorld()).getHandle(); EntityArrow arrow = new EntityArrow(world, getHandle()); + world.addEntity(arrow); return (Arrow) arrow.getBukkitEntity(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 691995a78f..20b539bd39 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -147,8 +147,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void playNote(Location loc, byte instrument, byte note) { - getHandle().netServerHandler.sendPacket( - new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), instrument, note)); + getHandle().netServerHandler.sendPacket(new Packet54PlayNoteBlock(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), instrument, note)); } public void playEffect(Location loc, Effect effect, int data) { @@ -162,9 +161,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player { } public void sendBlockChange(Location loc, int material, byte data) { - Packet53BlockChange packet = new Packet53BlockChange( - loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), - ((CraftWorld) loc.getWorld()).getHandle()); + Packet53BlockChange packet = new Packet53BlockChange(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), ((CraftWorld) loc.getWorld()).getHandle()); + packet.d = material; packet.e = data; getHandle().netServerHandler.sendPacket(packet); @@ -219,8 +217,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle(); // Grab the EntityPlayer EntityPlayer entity = getHandle(); + // Check if the fromWorld and toWorld are the same. - if (fromWorld == toWorld){ + if (fromWorld == toWorld) { entity.netServerHandler.teleport(to); } else { server.getHandle().a(entity, toWorld.dimension, to); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java index da4208d6ab..671394e64e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWeather.java @@ -12,6 +12,6 @@ public class CraftWeather extends CraftEntity implements Weather { @Override public EntityWeather getHandle() { - return (EntityWeather)super.getHandle(); + return (EntityWeather) super.getHandle(); } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index b909ec5439..94d24f7d6b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -5,7 +5,8 @@ import net.minecraft.server.EntityZombie; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Zombie; -public class CraftZombie extends CraftMonster implements Zombie{ + +public class CraftZombie extends CraftMonster implements Zombie { public CraftZombie(CraftServer server, EntityZombie entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 94d13b3c48..a21d136519 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -116,7 +116,7 @@ public class CraftEventFactory { if (type == Type.PLAYER_BUCKET_EMPTY) { event = new PlayerBucketEmptyEvent(player, blockClicked, blockFace, bucket, itemInHand); ((PlayerBucketEmptyEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ)); - } else if(type == Type.PLAYER_BUCKET_FILL) { + } else if (type == Type.PLAYER_BUCKET_FILL) { event = new PlayerBucketFillEvent(player, blockClicked, blockFace, bucket, itemInHand); ((PlayerBucketFillEvent) event).setCancelled(!canBuild(craftWorld, player, clickedX, clickedZ)); } diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index bb27d75cfc..9b2d501876 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -17,7 +17,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { private final Random random; public CustomChunkGenerator(World world, long seed, ChunkGenerator generator) { - this.world = (WorldServer)world; + this.world = (WorldServer) world; this.seed = seed; this.generator = generator; @@ -29,7 +29,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { } public Chunk getOrCreateChunk(int x, int z) { - random.setSeed((long)x * 341873128712L + (long)z * 132897987541L); + random.setSeed((long) x * 341873128712L + (long) z * 132897987541L); byte[] types = generator.generate(world.getWorld(), random, x, z); Chunk chunk = new Chunk(world, types, x, z); diff --git a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java index f567d7f1d5..1ab59ce27d 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/NormalChunkGenerator.java @@ -22,7 +22,7 @@ public class NormalChunkGenerator extends InternalChunkGenerator { } public boolean canSpawn(org.bukkit.World world, int x, int z) { - return ((CraftWorld)world).getHandle().worldProvider.a(x, z); + return ((CraftWorld) world).getHandle().worldProvider.a(x, z); } public List getDefaultPopulators(org.bukkit.World world) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java index 9cc8d436a6..439c671e52 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -270,7 +270,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory { } public HashMap removeItem(ItemStack... items) { - HashMap leftover = new HashMap(); + HashMap leftover = new HashMap(); // TODO: optimization diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java index ee51f9d241..6cda49b1d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryPlayer.java @@ -73,16 +73,17 @@ public class CraftInventoryPlayer extends CraftInventory implements PlayerInvent } public void setArmorContents(ItemStack[] items) { - int cnt = getSize(); - if (items == null) { - items = new ItemStack[4]; - } - for (ItemStack item : items) { - if (item == null || item.getTypeId() == 0) { - clear(cnt++); - } else { - setItem(cnt++, item); - } - } + int cnt = getSize(); + + if (items == null) { + items = new ItemStack[4]; + } + for (ItemStack item : items) { + if (item == null || item.getTypeId() == 0) { + clear(cnt++); + } else { + setItem(cnt++, item); + } + } } } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java index ca596fefe4..ebb14fb924 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftFuture.java @@ -24,7 +24,7 @@ public class CraftFuture implements Runnable, Future { } public void run() { - synchronized(this) { + synchronized (this) { if (cancelled) { return; } @@ -35,7 +35,7 @@ public class CraftFuture implements Runnable, Future { } catch (Exception e) { this.e = e; } - synchronized(this) { + synchronized (this) { running = false; done = true; this.notify(); @@ -50,7 +50,7 @@ public class CraftFuture implements Runnable, Future { } public T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { - synchronized(this) { + synchronized (this) { if (isDone()) { return getResult(); } @@ -63,31 +63,31 @@ public class CraftFuture implements Runnable, Future { if (cancelled) { throw new CancellationException(); } - if (e!=null) { + if (e != null) { throw new ExecutionException(e); } return returnStore.getObject(); } public boolean isDone() { - synchronized(this) { + synchronized (this) { return done; } } public boolean isCancelled() { - synchronized(this) { + synchronized (this) { return cancelled; } } public boolean cancel(boolean mayInterruptIfRunning) { - synchronized(this) { + synchronized (this) { if (cancelled) { return false; } cancelled = true; - if (taskId!=-1) { + if (taskId != -1) { craftScheduler.cancelTask(taskId); } if (!running && !done) { @@ -99,7 +99,7 @@ public class CraftFuture implements Runnable, Future { } public void setTaskId(int taskId) { - synchronized(this) { + synchronized (this) { this.taskId = taskId; } } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java index 707de0878a..d2cd7ad094 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -33,7 +33,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { private final LinkedList mainThreadQueue = new LinkedList(); private final LinkedList syncedTasks = new LinkedList(); - private final TreeMap schedulerQueue = new TreeMap(); + private final TreeMap schedulerQueue = new TreeMap(); private final Object currentTickSync = new Object(); private Long currentTick = 0L; @@ -54,7 +54,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { first = null; if (!schedulerQueue.isEmpty()) { first = schedulerQueue.firstKey(); - if (first!=null) { + if (first != null) { currentTick = getCurrentTick(); firstTick = first.getExecutionTick(); @@ -62,7 +62,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { if (currentTick >= firstTick) { schedulerQueue.remove(first); processTask(first); - if (first.getPeriod()>=0) { + if (first.getPeriod() >= 0) { first.updateExecution(); schedulerQueue.put(first, first.isSync()); } @@ -83,7 +83,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { sleepTime = 60000L; } else { currentTick = getCurrentTick(); - sleepTime = (firstTick-currentTick)*50 + 25; + sleepTime = (firstTick - currentTick) * 50 + 25; } if (sleepTime < 50L) { @@ -95,8 +95,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { synchronized (schedulerQueue) { try { schedulerQueue.wait(sleepTime); - } catch (InterruptedException ie) { - } + } catch (InterruptedException ie) {} } } } @@ -207,7 +206,8 @@ public class CraftScheduler implements BukkitScheduler, Runnable { throw new IllegalArgumentException("Delay cannot be less than 0"); } - CraftTask newTask = new CraftTask(plugin, task, true, getCurrentTick()+delay, period); + CraftTask newTask = new CraftTask(plugin, task, true, getCurrentTick() + delay, period); + synchronized (schedulerQueue) { schedulerQueue.put(newTask, true); schedulerQueue.notify(); @@ -234,7 +234,8 @@ public class CraftScheduler implements BukkitScheduler, Runnable { throw new IllegalArgumentException("Delay cannot be less than 0"); } - CraftTask newTask = new CraftTask(plugin, task, false, getCurrentTick()+delay, period); + CraftTask newTask = new CraftTask(plugin, task, false, getCurrentTick() + delay, period); + synchronized (schedulerQueue) { schedulerQueue.put(newTask, false); schedulerQueue.notify(); @@ -267,7 +268,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { public void cancelTasks(Plugin plugin) { syncedTasksLock.lock(); try { - synchronized(schedulerQueue) { + synchronized (schedulerQueue) { mainThreadLock.lock(); try { Iterator itr = schedulerQueue.keySet().iterator(); @@ -312,7 +313,7 @@ public class CraftScheduler implements BukkitScheduler, Runnable { craftThreadManager.interruptAllTasks(); } - public boolean isCurrentlyRunning(int taskId){ + public boolean isCurrentlyRunning(int taskId) { return craftThreadManager.isAlive(taskId); } @@ -333,8 +334,9 @@ public class CraftScheduler implements BukkitScheduler, Runnable { synchronized (craftThreadManager.workers) { List workerList = new ArrayList(craftThreadManager.workers.size()); Iterator itr = craftThreadManager.workers.iterator(); + while (itr.hasNext()) { - workerList.add((BukkitWorker)itr.next()); + workerList.add((BukkitWorker) itr.next()); } return workerList; } @@ -359,8 +361,9 @@ public class CraftScheduler implements BukkitScheduler, Runnable { syncedTasksLock.unlock(); } List newTaskList = new ArrayList(taskList.size()); + for (CraftTask craftTask : taskList) { - newTaskList.add((BukkitTask)craftTask); + newTaskList.add((BukkitTask) craftTask); } return newTaskList; } diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java index 4227dbc923..2304719e99 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -79,9 +79,9 @@ public class CraftTask implements Comparable, BukkitTask { } else { CraftTask o = (CraftTask) other; long timeDiff = executionTick - o.getExecutionTick(); - if (timeDiff>0) { + if (timeDiff > 0) { return 1; - } else if (timeDiff<0) { + } else if (timeDiff < 0) { return -1; } else { CraftTask otherCraftTask = (CraftTask) other; diff --git a/src/main/java/org/bukkit/craftbukkit/util/ConcurrentSoftMap.java b/src/main/java/org/bukkit/craftbukkit/util/ConcurrentSoftMap.java index bbf5693bc9..674f9bd1ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/ConcurrentSoftMap.java +++ b/src/main/java/org/bukkit/craftbukkit/util/ConcurrentSoftMap.java @@ -27,9 +27,9 @@ import java.lang.ref.SoftReference; * @author raphfrk */ -public class ConcurrentSoftMap { +public class ConcurrentSoftMap { - private final ConcurrentHashMap> map = new ConcurrentHashMap>(); + private final ConcurrentHashMap> map = new ConcurrentHashMap>(); private final ReferenceQueue queue = new ReferenceQueue(); private final LinkedList strongReferenceQueue = new LinkedList(); private final int strongReferenceSize; @@ -51,17 +51,18 @@ public class ConcurrentSoftMap { private void emptyQueue() { SoftMapReference ref; - while ((ref=(SoftMapReference) queue.poll()) != null) { + + while ((ref = (SoftMapReference) queue.poll()) != null) { map.remove(ref.key); } } public void clear() { - synchronized(strongReferenceQueue) { - strongReferenceQueue.clear(); - } - map.clear(); - emptyQueue(); + synchronized (strongReferenceQueue) { + strongReferenceQueue.clear(); + } + map.clear(); + emptyQueue(); } // Shouldn't support this, since the garbage collection is async @@ -88,8 +89,8 @@ public class ConcurrentSoftMap { // Doesn't support these either public boolean equals(Object o) { - emptyQueue(); - throw new UnsupportedOperationException("SoftMap doesn't support equals checks"); + emptyQueue(); + throw new UnsupportedOperationException("SoftMap doesn't support equals checks"); } // This operation returns null if the entry is not in the map @@ -100,13 +101,15 @@ public class ConcurrentSoftMap { } private V fastGet(K key) { - SoftMapReference ref = map.get(key); - if (ref==null) { + SoftMapReference ref = map.get(key); + + if (ref == null) { return null; } V value = ref.get(); - if (value!=null) { - synchronized(strongReferenceQueue) { + + if (value != null) { + synchronized (strongReferenceQueue) { strongReferenceQueue.addFirst(value); if (strongReferenceQueue.size() > strongReferenceSize) { strongReferenceQueue.removeLast(); @@ -119,8 +122,8 @@ public class ConcurrentSoftMap { // Doesn't support this either public int hashCode() { - emptyQueue(); - throw new UnsupportedOperationException("SoftMap doesn't support hashCode"); + emptyQueue(); + throw new UnsupportedOperationException("SoftMap doesn't support hashCode"); } // This is another risky method, since again, garbage collection is async @@ -147,8 +150,8 @@ public class ConcurrentSoftMap { } private void fastPut(K key, V value) { - map.put(key, new SoftMapReference(key, value, queue)); - synchronized(strongReferenceQueue) { + map.put(key, new SoftMapReference(key, value, queue)); + synchronized (strongReferenceQueue) { strongReferenceQueue.addFirst(value); if (strongReferenceQueue.size() > strongReferenceSize) { strongReferenceQueue.removeLast(); @@ -161,21 +164,23 @@ public class ConcurrentSoftMap { return fastPutIfAbsent(key, value); } - private V fastPutIfAbsent(K key, V value) { + private V fastPutIfAbsent(K key, V value) { V ret = null; if (map.containsKey(key)) { - SoftMapReference current = map.get(key); - if (current != null) { - ret = current.get(); - } + SoftMapReference current = map.get(key); + + if (current != null) { + ret = current.get(); + } } if (ret == null) { - SoftMapReference newValue = new SoftMapReference(key, value, queue); + SoftMapReference newValue = new SoftMapReference(key, value, queue); boolean success = false; + while (!success) { - SoftMapReference oldValue = map.putIfAbsent(key, newValue); + SoftMapReference oldValue = map.putIfAbsent(key, newValue); if (oldValue == null) { // put was successful (key didn't exist) ret = null; @@ -192,7 +197,7 @@ public class ConcurrentSoftMap { } if (ret == null) { - synchronized(strongReferenceQueue) { + synchronized (strongReferenceQueue) { strongReferenceQueue.addFirst(value); if (strongReferenceQueue.size() > strongReferenceSize) { strongReferenceQueue.removeLast(); @@ -218,7 +223,8 @@ public class ConcurrentSoftMap { public V remove(K key) { emptyQueue(); - SoftMapReference ref = map.remove(key); + SoftMapReference ref = map.remove(key); + if (ref != null) { return ref.get(); } @@ -239,8 +245,7 @@ public class ConcurrentSoftMap { throw new UnsupportedOperationException("SoftMap does not support this operation, since it creates potentially stong references"); } - - private static class SoftMapReference extends SoftReference { + private static class SoftMapReference extends SoftReference { K key; SoftMapReference(K key, V value, ReferenceQueue queue) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java index fc59df7782..b438e8faef 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java +++ b/src/main/java/org/bukkit/craftbukkit/util/LongHashtable.java @@ -14,7 +14,7 @@ public class LongHashtable extends LongHash { if (value instanceof Chunk) { Chunk c = (Chunk) value; if (msw != c.x || lsw != c.z) { - MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")"); + MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z + ") stored at (" + msw + ", " + lsw + ")"); Throwable x = new Throwable(); x.fillInStackTrace(); x.printStackTrace(); @@ -27,7 +27,7 @@ public class LongHashtable extends LongHash { if (value instanceof Chunk) { Chunk c = (Chunk) value; if (msw != c.x || lsw != c.z) { - MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z +") stored at (" + msw + ", " + lsw + ")"); + MinecraftServer.log.info("Chunk (" + c.x + ", " + c.z + ") stored at (" + msw + ", " + lsw + ")"); Throwable x = new Throwable(); x.fillInStackTrace(); x.printStackTrace(); diff --git a/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java b/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java index 282f058d90..42885fdef5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java +++ b/src/main/java/org/bukkit/craftbukkit/util/ShortConsoleLogFormatter.java @@ -21,7 +21,7 @@ public class ShortConsoleLogFormatter extends Formatter { Object object = options.valueOf("date-format"); if ((object != null) && (object instanceof SimpleDateFormat)) { - date = (SimpleDateFormat)object; + date = (SimpleDateFormat) object; } } catch (OptionException ex) { System.err.println("Given date format is not valid. Falling back to default.");