Fix formatting.
This commit is contained in:
@@ -132,7 +132,7 @@ public class BlockFlowing extends BlockFluids {
|
||||
BlockFace[] faces = new BlockFace[] { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
|
||||
int index = 0;
|
||||
|
||||
for (BlockFace currentFace: faces) {
|
||||
for (BlockFace currentFace : faces) {
|
||||
if (aboolean[index]) {
|
||||
BlockFromToEvent event = new BlockFromToEvent(source, currentFace);
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class BlockPressurePlate extends Block {
|
||||
|
||||
if (flag != flag1) {
|
||||
if (flag1) {
|
||||
for (Object object: list) {
|
||||
for (Object object : list) {
|
||||
if (object != null) {
|
||||
org.bukkit.event.Cancellable cancellable;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.logging.Logger;
|
||||
import java.util.logging.Handler;
|
||||
import org.bukkit.craftbukkit.util.ShortConsoleLogFormatter;
|
||||
import org.bukkit.craftbukkit.util.TerminalConsoleHandler;
|
||||
|
||||
// CraftBukkit end
|
||||
|
||||
public class ConsoleLogManager {
|
||||
@@ -16,7 +17,8 @@ public class ConsoleLogManager {
|
||||
public static Logger a = Logger.getLogger("Minecraft");
|
||||
public static Logger global = Logger.getLogger(""); // CraftBukkit
|
||||
|
||||
public ConsoleLogManager() {}
|
||||
public ConsoleLogManager() {
|
||||
}
|
||||
|
||||
// CraftBukkit - change of method signature!
|
||||
public static void init(MinecraftServer server) {
|
||||
@@ -26,7 +28,7 @@ public class ConsoleLogManager {
|
||||
// CraftBukkit start
|
||||
ConsoleHandler consolehandler = new TerminalConsoleHandler(server.reader);
|
||||
|
||||
for (Handler handler: global.getHandlers()) {
|
||||
for (Handler handler : global.getHandlers()) {
|
||||
global.removeHandler(handler);
|
||||
}
|
||||
|
||||
@@ -38,10 +40,10 @@ public class ConsoleLogManager {
|
||||
|
||||
try {
|
||||
// CraftBukkit start
|
||||
String pattern = (String)server.options.valueOf("log-pattern");
|
||||
int limit = ((Integer)server.options.valueOf("log-limit")).intValue();
|
||||
int count = ((Integer)server.options.valueOf("log-count")).intValue();
|
||||
boolean append = ((Boolean)server.options.valueOf("log-append")).booleanValue();
|
||||
String pattern = (String) server.options.valueOf("log-pattern");
|
||||
int limit = ((Integer) server.options.valueOf("log-limit")).intValue();
|
||||
int count = ((Integer) server.options.valueOf("log-count")).intValue();
|
||||
boolean append = ((Boolean) server.options.valueOf("log-append")).booleanValue();
|
||||
FileHandler filehandler = new FileHandler(pattern, limit, count, append);
|
||||
// CraftBukkit end
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.minecraft.server;
|
||||
import org.bukkit.craftbukkit.enchantments.CraftEnchantment;
|
||||
|
||||
public abstract class Enchantment {
|
||||
// CraftBukkit - update CraftEnchant.getName(i) if this changes.
|
||||
// CraftBukkit - update CraftEnchant.getName(i) if this changes.
|
||||
public static final Enchantment[] byId = new Enchantment[256];
|
||||
public static final Enchantment PROTECTION_ENVIRONMENTAL = new EnchantmentProtection(0, 10, 0);
|
||||
public static final Enchantment PROTECTION_FIRE = new EnchantmentProtection(1, 5, 1);
|
||||
|
||||
@@ -73,9 +73,9 @@ public class EntityEgg extends EntityProjectile {
|
||||
if (hatching) {
|
||||
for (int k = 0; k < numHatching; k++) {
|
||||
org.bukkit.entity.Entity entity = world.getWorld().spawn(new Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), SpawnReason.EGG);
|
||||
|
||||
|
||||
if (entity instanceof Animals) {
|
||||
((Animals)entity).setAge(-24000);
|
||||
((Animals) entity).setAge(-24000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,8 +491,8 @@ public class EntityEnderDragon extends EntityComplex {
|
||||
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.
|
||||
// We should consider adding an event extension for it, or perhaps returning true if the event is cancelled.
|
||||
// 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 {
|
||||
for (org.bukkit.block.Block block : event.blockList()) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class EntityEnderPearl extends EntityProjectile {
|
||||
|
||||
if (this.shooter != null) {
|
||||
if (this.shooter instanceof EntityPlayer) {
|
||||
CraftPlayer player = (CraftPlayer)this.shooter.bukkitEntity;
|
||||
CraftPlayer player = (CraftPlayer) this.shooter.bukkitEntity;
|
||||
teleport = player.isOnline();
|
||||
|
||||
if (teleport) {
|
||||
@@ -50,7 +50,7 @@ public class EntityEnderPearl extends EntityProjectile {
|
||||
|
||||
if (teleport) {
|
||||
if (this.shooter instanceof EntityPlayer) {
|
||||
((EntityPlayer)this.shooter).netServerHandler.teleport(teleEvent.getTo());
|
||||
((EntityPlayer) this.shooter).netServerHandler.teleport(teleEvent.getTo());
|
||||
} else {
|
||||
this.shooter.enderTeleportTo(this.locX, this.locY, this.locZ);
|
||||
}
|
||||
|
||||
@@ -843,7 +843,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
if (l > 0) {
|
||||
// CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
|
||||
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l*4);
|
||||
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
|
||||
Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
|
||||
if (!combustEvent.isCancelled()) {
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.minecraft.server;
|
||||
// CraftBukkit start
|
||||
import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
// CraftBukkit End
|
||||
// CraftBukkit end
|
||||
|
||||
public class EntityItem extends Entity {
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ public class EntityPainting extends Entity {
|
||||
this.f = 0;
|
||||
if (!this.survives()) {
|
||||
// CraftBukkit start
|
||||
Material material = this.world.getMaterial((int)this.locX, (int)this.locY, (int)this.locZ);
|
||||
Material material = this.world.getMaterial((int) this.locX, (int) this.locY, (int) this.locZ);
|
||||
RemoveCause cause;
|
||||
if (material.equals(Material.WATER)) {
|
||||
cause = RemoveCause.WATER;
|
||||
@@ -142,7 +142,7 @@ public class EntityPainting extends Entity {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!dead) {
|
||||
if (!dead) {
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class EntityPig extends EntityAnimal {
|
||||
// CraftBukkit end
|
||||
|
||||
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
|
||||
// CraftBukkit - added a reason for spawning this creature
|
||||
// CraftBukkit - added a reason for spawning this creature
|
||||
this.world.addEntity(entitypigzombie, SpawnReason.LIGHTNING);
|
||||
this.die();
|
||||
}
|
||||
|
||||
@@ -633,12 +633,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
|
||||
public void reset() {
|
||||
float exp = 0;
|
||||
if(this.keepLevel) {
|
||||
if (this.keepLevel) {
|
||||
exp = this.exp;
|
||||
this.newTotalExp = this.expTotal;
|
||||
this.newLevel = this.expLevel;
|
||||
}
|
||||
|
||||
|
||||
this.health = 20;
|
||||
this.fireTicks = 0;
|
||||
this.fallDistance = 0;
|
||||
@@ -650,7 +650,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
effects.clear();
|
||||
this.activeContainer = this.defaultContainer;
|
||||
this.lastSentExp = -1;
|
||||
if(this.keepLevel) {
|
||||
if (this.keepLevel) {
|
||||
this.exp = exp;
|
||||
} else {
|
||||
this.giveExp(this.newExp);
|
||||
@@ -659,7 +659,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public CraftPlayer getPlayer() {
|
||||
return (CraftPlayer)getBukkitEntity();
|
||||
return (CraftPlayer) getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -119,15 +119,15 @@ public class EntitySpider extends EntityMonster {
|
||||
// CraftBukkit start - whole method; adapted from super.dropDeathLoot.
|
||||
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
|
||||
int k = this.random.nextInt(3);
|
||||
int k = this.random.nextInt(3);
|
||||
|
||||
if (i > 0) {
|
||||
k += this.random.nextInt(i + 1);
|
||||
}
|
||||
if (i > 0) {
|
||||
k += this.random.nextInt(i + 1);
|
||||
}
|
||||
|
||||
if (k > 0) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.STRING.id, k));
|
||||
}
|
||||
if (k > 0) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.STRING.id, k));
|
||||
}
|
||||
|
||||
if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) {
|
||||
loot.add(new org.bukkit.inventory.ItemStack(Item.SPIDER_EYE.id, 1));
|
||||
|
||||
@@ -117,7 +117,7 @@ public class EntityWolf extends EntityAnimal {
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled() || event.getTarget() != null ) {
|
||||
if (!event.isCancelled() || event.getTarget() != null) {
|
||||
this.setTarget(entity);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -71,8 +71,7 @@ public class ItemBlock extends Item {
|
||||
CraftBlockState blockStateBelow = null;
|
||||
// Toggles whether the normal or the block below is used for the place event
|
||||
boolean eventUseBlockBelow = false;
|
||||
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id)
|
||||
&& (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
|
||||
if ((world.getTypeId(i, j - 1, k) == Block.STEP.id || world.getTypeId(i, j - 1, k) == Block.DOUBLE_STEP.id) && (itemstack.id == Block.DOUBLE_STEP.id || itemstack.id == Block.STEP.id)) {
|
||||
blockStateBelow = CraftBlockState.getBlockState(world, i, j - 1, k);
|
||||
// Step is placed on step, forms a doublestep replacing the original step, so we need the lower block
|
||||
eventUseBlockBelow = itemstack.id == Block.STEP.id && blockStateBelow.getTypeId() == Block.STEP.id;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ItemDye extends Item {
|
||||
if (i1 == Block.SAPLING.id) {
|
||||
if (!world.isStatic) {
|
||||
// CraftBukkit start
|
||||
Player player = (entityhuman instanceof EntityPlayer) ? (Player)entityhuman.getBukkitEntity() : null;
|
||||
Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
|
||||
((BlockSapling) Block.SAPLING).grow(world, i, j, k, world.random, true, player, itemstack);
|
||||
//--itemstack.count; - called later if the bonemeal attempt was succesful
|
||||
// CraftBukkit end
|
||||
@@ -41,7 +41,7 @@ public class ItemDye extends Item {
|
||||
if (i1 == Block.BROWN_MUSHROOM.id || i1 == Block.RED_MUSHROOM.id) {
|
||||
// CraftBukkit start
|
||||
if (!world.isStatic) {
|
||||
Player player = (entityhuman instanceof EntityPlayer) ? (Player)entityhuman.getBukkitEntity() : null;
|
||||
Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
|
||||
((BlockMushroom) Block.byId[i1]).grow(world, i, j, k, world.random, true, player, itemstack);
|
||||
//--itemstack.count; - called later if the bonemeal attempt was succesful
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ItemFishingRod extends Item {
|
||||
entityhuman.s_();
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null,PlayerFishEvent.State.FISHING);
|
||||
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
|
||||
world.getServer().getPluginManager().callEvent(playerFishEvent);
|
||||
|
||||
if (playerFishEvent.isCancelled()) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ItemRedstone extends Item {
|
||||
return false;
|
||||
}
|
||||
|
||||
world.update( i, j, k, Block.REDSTONE_WIRE.id); // Must take place after BlockPlaceEvent, we need to update all other blocks.
|
||||
world.update(i, j, k, Block.REDSTONE_WIRE.id); // Must take place after BlockPlaceEvent, we need to update all other blocks.
|
||||
// CraftBukkit end
|
||||
|
||||
--itemstack.count; // CraftBukkit - ORDER MATTERS
|
||||
|
||||
@@ -502,7 +502,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
|
||||
|
||||
// Send timeupdates to everyone, it will get the right time from the world the player is in.
|
||||
if (this.ticks % 20 == 0) {
|
||||
for ( k = 0; k < this.serverConfigurationManager.players.size(); ++k) {
|
||||
for (k = 0; k < this.serverConfigurationManager.players.size(); ++k) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.serverConfigurationManager.players.get(k);
|
||||
entityplayer.netServerHandler.sendPacket(new Packet4UpdateTime(entityplayer.getPlayerTime())); // Add support for per player time
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class NetLoginHandler extends NetHandler {
|
||||
|
||||
netserverhandler.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
|
||||
this.server.serverConfigurationManager.a(entityplayer, worldserver);
|
||||
// this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
|
||||
// this.server.serverConfigurationManager.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - message moved to join event
|
||||
this.server.serverConfigurationManager.c(entityplayer);
|
||||
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
|
||||
this.server.networkListenThread.a(netserverhandler);
|
||||
|
||||
@@ -65,6 +65,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit start
|
||||
this.server = minecraftserver.server;
|
||||
}
|
||||
|
||||
private final CraftServer server;
|
||||
private int lastTick = MinecraftServer.currentTick;
|
||||
private int lastDropTick = MinecraftServer.currentTick;
|
||||
@@ -674,7 +675,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.x, packet6.y, packet6.z);
|
||||
} else if (packet instanceof Packet3Chat) {
|
||||
String message = ((Packet3Chat) packet).message;
|
||||
for (final String line: TextWrapper.wrapText(message)) {
|
||||
for (final String line : TextWrapper.wrapText(message)) {
|
||||
this.networkManager.queue(new Packet3Chat(line));
|
||||
}
|
||||
packet = null;
|
||||
|
||||
@@ -103,7 +103,7 @@ public abstract class Packet {
|
||||
}
|
||||
|
||||
// CraftBukkit - throws IOException
|
||||
public static void a(String s, DataOutputStream dataoutputstream) throws IOException {
|
||||
public static void a(String s, DataOutputStream dataoutputstream) throws IOException {
|
||||
if (s.length() > 32767) {
|
||||
throw new IOException("String too big");
|
||||
} else {
|
||||
@@ -113,7 +113,7 @@ public abstract class Packet {
|
||||
}
|
||||
|
||||
// CraftBukkit - throws IOException
|
||||
public static String a(DataInputStream datainputstream, int i) throws IOException {
|
||||
public static String a(DataInputStream datainputstream, int i) throws IOException {
|
||||
short short1 = datainputstream.readShort();
|
||||
|
||||
if (short1 > i) {
|
||||
|
||||
@@ -18,13 +18,16 @@ public final class SpawnerCreature {
|
||||
// private static HashMap b = new HashMap(); // CraftBukkit - moved local to spawnEntities
|
||||
static private class ChunkEntry extends EntryBase {
|
||||
public boolean spawn;
|
||||
public ChunkEntry (int x, int z, boolean spawn) {
|
||||
|
||||
public ChunkEntry(int x, int z, boolean spawn) {
|
||||
super(LongHash.toLong(x, z));
|
||||
this.spawn = spawn;
|
||||
}
|
||||
|
||||
int getX() {
|
||||
return LongHash.msw(key);
|
||||
}
|
||||
|
||||
int getZ() {
|
||||
return LongHash.lsw(key);
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
TileEntity entity = this.world.getTileEntity(x, y, z);
|
||||
|
||||
if (entity instanceof TileEntityChest) {
|
||||
return (TileEntityChest)entity;
|
||||
return (TileEntityChest) entity;
|
||||
} else {
|
||||
String name = "null";
|
||||
if (entity != null) {
|
||||
|
||||
@@ -15,6 +15,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
|
||||
// CraftBukkit start
|
||||
private int lastTick = (int) (System.currentTimeMillis() / 50);
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
@@ -864,9 +864,8 @@ public class World implements IBlockAccess {
|
||||
return this.addEntity(entity, SpawnReason.CUSTOM); // Set reason as Custom by default
|
||||
}
|
||||
|
||||
|
||||
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
|
||||
// CraftBukkit end
|
||||
// CraftBukkit end
|
||||
int i = MathHelper.floor(entity.locX / 16.0D);
|
||||
int j = MathHelper.floor(entity.locZ / 16.0D);
|
||||
boolean flag = false;
|
||||
@@ -2307,7 +2306,7 @@ public class World implements IBlockAccess {
|
||||
} else {
|
||||
if (i > 1000) {
|
||||
// CraftBukkit start - if the server has too much to process over time, try to alleviate that
|
||||
if(i > 20 * 1000) {
|
||||
if (i > 20 * 1000) {
|
||||
i = i / 20;
|
||||
} else {
|
||||
i = 1000;
|
||||
|
||||
@@ -217,7 +217,7 @@ public class WorldGenBigTree extends WorldGenerator {
|
||||
aint3[b3] = MathHelper.floor((double) aint[b3] + (double) j * d1 + 0.5D);
|
||||
// CraftBukkit start
|
||||
if (event == null) {
|
||||
this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], i, 0);
|
||||
this.setTypeAndData(this.world, aint3[0], aint3[1], aint3[2], i, 0);
|
||||
} else {
|
||||
BlockState state = bukkitWorld.getBlockAt(aint3[0], aint3[1], aint3[2]).getState();
|
||||
state.setTypeId(i);
|
||||
|
||||
@@ -205,7 +205,7 @@ public class WorldNBTStorage implements PlayerFileData, IDataManager {
|
||||
if (nbttagcompound != null) {
|
||||
// CraftBukkit start
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
CraftPlayer player = (CraftPlayer)entityhuman.bukkitEntity;
|
||||
CraftPlayer player = (CraftPlayer) entityhuman.bukkitEntity;
|
||||
player.setFirstPlayed(new File(playerDir, entityhuman.name + ".dat").lastModified());
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@@ -82,7 +82,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
+ "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.");
|
||||
|
||||
if (Block.byId[type] instanceof BlockContainer) {
|
||||
TileEntity replacement = ((BlockContainer)Block.byId[type]).a_();
|
||||
TileEntity replacement = ((BlockContainer) Block.byId[type]).a_();
|
||||
setTileEntity(x, y, z, replacement);
|
||||
return replacement;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user