summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/BlockButton.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockCactus.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockDispenser.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockFire.java21
-rw-r--r--src/main/java/net/minecraft/server/BlockFlowing.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockLever.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java7
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneWire.java7
-rw-r--r--src/main/java/net/minecraft/server/BlockStationary.java6
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java6
-rw-r--r--src/main/java/net/minecraft/server/ChunkProviderServer.java18
-rw-r--r--src/main/java/net/minecraft/server/ConsoleCommandHandler.java2
-rw-r--r--src/main/java/net/minecraft/server/ConsoleLogManager.java17
-rw-r--r--src/main/java/net/minecraft/server/Entity.java69
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java5
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java9
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java12
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java7
-rw-r--r--src/main/java/net/minecraft/server/EntityFireball.java10
-rw-r--r--src/main/java/net/minecraft/server/EntityFish.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java18
-rw-r--r--src/main/java/net/minecraft/server/EntityItem.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java30
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java17
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java14
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java23
-rw-r--r--src/main/java/net/minecraft/server/EntitySkeleton.java15
-rw-r--r--src/main/java/net/minecraft/server/EntitySnowball.java2
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java3
-rw-r--r--src/main/java/net/minecraft/server/EntityTNTPrimed.java13
-rw-r--r--src/main/java/net/minecraft/server/EntityTracker.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java3
-rw-r--r--src/main/java/net/minecraft/server/EntityZombie.java1
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java21
-rw-r--r--src/main/java/net/minecraft/server/InventoryPlayer.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemInWorldManager.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemStack.java2
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java62
-rw-r--r--src/main/java/net/minecraft/server/NetLoginHandler.java4
-rw-r--r--src/main/java/net/minecraft/server/NetServerHandler.java104
-rw-r--r--src/main/java/net/minecraft/server/PlayerInstance.java25
-rw-r--r--src/main/java/net/minecraft/server/PlayerManager.java10
-rw-r--r--src/main/java/net/minecraft/server/PropertyManager.java4
-rw-r--r--src/main/java/net/minecraft/server/ServerConfigurationManager.java59
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java2
-rw-r--r--src/main/java/net/minecraft/server/World.java17
-rw-r--r--src/main/java/net/minecraft/server/WorldGenBigTree.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldGenForest.java5
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga1.java5
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga2.java5
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTrees.java5
-rw-r--r--src/main/java/net/minecraft/server/WorldManager.java9
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java15
57 files changed, 415 insertions, 344 deletions
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java
index ba4d1fe8..6121e602 100644
--- a/src/main/java/net/minecraft/server/BlockButton.java
+++ b/src/main/java/net/minecraft/server/BlockButton.java
@@ -148,7 +148,7 @@ public class BlockButton extends Block {
if (j1 == 0) {
return true;
} else {
- // Craftbukkit start
+ // CraftBukkit start
int old = (j1 != 8) ? 1 : 0;
int current = (j1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
@@ -156,7 +156,7 @@ public class BlockButton extends Block {
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
return true;
}
- // Craftbukkit end
+ // CraftBukkit end
world.c(i, j, k, i1 + j1);
world.b(i, j, k, i, j, k);
@@ -227,14 +227,14 @@ public class BlockButton extends Block {
int l = world.getData(i, j, k);
if ((l & 8) != 0) {
- // Craftbukkit start
+ // CraftBukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
server.getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) return;
- // Craftbukkit end
+ // CraftBukkit end
world.c(i, j, k, l & 7);
world.h(i, j, k, this.id);
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index b0831145..ffa42f97 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -80,17 +80,17 @@ public class BlockCactus extends Block {
public void a(World world, int i, int j, int k, Entity entity) {
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
- if(entity instanceof EntityLiving) {
+ if (entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
- org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
+ org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT;
int damageDone = 1;
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
entity.a((Entity) null, event.getDamage());
}
return;
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index e86b1c56..664ee728 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -67,7 +67,7 @@ public class BlockDispenser extends BlockContainer {
CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.BLOCK_INTERACT;
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
- LivingEntity who = (entityhuman == null)?null:(LivingEntity)entityhuman.getBukkitEntity();
+ LivingEntity who = (entityhuman == null) ? null : (LivingEntity) entityhuman.getBukkitEntity();
BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(event);
@@ -84,7 +84,7 @@ public class BlockDispenser extends BlockContainer {
}
}
- // Craftbukkit - following method should be public
+ // CraftBukkit - private->public
public void b(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
float f = 0.0F;
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 8dde0553..55af20f0 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -61,7 +61,8 @@ public class BlockFire extends Block {
if (!world.d(i, j - 1, k) || l > 3) {
world.e(i, j, k, 0);
}
- } else if (!flag && !this.b((IBlockAccess)world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) { // CraftBukkit - Cast to IBlockAccess
+ // CraftBukkit - Cast to IBlockAccess
+ } else if (!flag && !this.b((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
world.e(i, j, k, 0);
} else {
if (l % 2 == 0 && l > 2) {
@@ -73,8 +74,8 @@ public class BlockFire extends Block {
this.a(world, i, j, k + 1, 300, random);
// CraftBukkit start - Call to stop spread of fire.
- Server server = ((WorldServer)world).getServer();
- CraftWorld cworld = ((WorldServer)world).getWorld();
+ Server server = ((WorldServer) world).getServer();
+ CraftWorld cworld = ((WorldServer) world).getWorld();
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
Player thePlayer = null;
@@ -94,9 +95,9 @@ public class BlockFire extends Block {
if (i2 > 0 && random.nextInt(l1) <= i2) {
// CraftBukkit start - Call to stop spread of fire.
- org.bukkit.block.Block theBlock = (cworld.getBlockAt(i1, k1, j1));
+ org.bukkit.block.Block theBlock = cworld.getBlockAt(i1, k1, j1);
- if (theBlock.getTypeId() != Block.FIRE.id){
+ if (theBlock.getTypeId() != Block.FIRE.id) {
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -130,16 +131,16 @@ public class BlockFire extends Block {
if (random.nextInt(l) < i1) {
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
// CraftBukkit start
- Server server = ((WorldServer)world).getServer();
- CraftWorld cworld = ((WorldServer)world).getWorld();
- org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
+ Server server = ((WorldServer) world).getServer();
+ CraftWorld cworld = ((WorldServer) world).getWorld();
+ org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
BlockBurnEvent event = new BlockBurnEvent(theBlock);
server.getPluginManager().callEvent(event);
- if(event.isCancelled()) {
+ if (event.isCancelled()) {
return;
}
// CraftBukkit end
-
+
if (random.nextInt(2) == 0) {
world.e(i, j, k, this.id);
} else {
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index cb567d41..70da69ce 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -28,9 +28,8 @@ public class BlockFlowing extends BlockFluids {
}
public void a(World world, int i, int j, int k, Random random) {
- // CraftBukkit start
+ // CraftBukkit
CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
- // CraftBukkit end
int l = this.g(world, i, j, k);
byte b0 = 1;
@@ -96,8 +95,7 @@ public class BlockFlowing extends BlockFluids {
}
if (this.l(world, i, j - 1, k)) {
- // CraftBukkit start
- // Craftbucket send "down" to the server
+ // CraftBukkit start - send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java
index d7ffb608..a702ae44 100644
--- a/src/main/java/net/minecraft/server/BlockLever.java
+++ b/src/main/java/net/minecraft/server/BlockLever.java
@@ -156,7 +156,7 @@ public class BlockLever extends Block {
return true;
}
// CraftBukkit end
-
+
world.c(i, j, k, i1 + j1);
world.b(i, j, k, i, j, k);
world.a((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, j1 > 0 ? 0.6F : 0.5F);
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
index 98391e49..85f5e00d 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java
@@ -113,14 +113,14 @@ public class BlockPressurePlate extends Block {
flag1 = true;
}
- // Craftbukkit start
+ // CraftBukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
server.getPluginManager().callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;
- // Craftbukkit end
+ // CraftBukkit end
if (flag1 && !flag) {
world.c(i, j, k, 1);
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index 4733f78b..d8c0ca90 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -98,14 +98,14 @@ public class BlockRedstoneTorch extends BlockTorch {
b.remove(0);
}
- // Craftbukkit start
+ // CraftBukkit start
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent event = new BlockRedstoneEvent(block, flag ? 15 : 0, flag ? 0 : 15);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
if ((event.getNewCurrent() != 0) == flag) {
return;
}
- // Craftbukkit end
+ // CraftBukkit end
if (this.a) {
if (flag) {
@@ -133,7 +133,8 @@ public class BlockRedstoneTorch extends BlockTorch {
}
public boolean c(World world, int i, int j, int k, int l) {
- return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false; // CraftBukkit -- cast to IBlockAccess
+ // CraftBukkit -- cast to IBlockAccess
+ return l == 0 ? this.b((IBlockAccess) world, i, j, k, l) : false;
}
public int a(int i, Random random) {
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 2b62393f..4fe8a15c 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -103,14 +103,14 @@ public class BlockRedstoneWire extends Block {
}
}
- // Craftbukkit start
+ // CraftBukkit start
if (k1 != l1) {
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent event = new BlockRedstoneEvent(block, k1, l1);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
l1 = event.getNewCurrent();
}
- // Craftbukkit end
+ // CraftBukkit end
if (k1 != l1) {
world.h = true;
@@ -293,7 +293,8 @@ public class BlockRedstoneWire extends Block {
}
public boolean c(World world, int i, int j, int k, int l) {
- return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l); // CraftBukkit -- cast to IBlockAccess
+ // CraftBukkit -- cast to IBlockAccess
+ return !this.a ? false : this.b((IBlockAccess) world, i, j, k, l);
}
public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java
index b69c0417..0d38b6fd 100644
--- a/src/main/java/net/minecraft/server/BlockStationary.java
+++ b/src/main/java/net/minecraft/server/BlockStationary.java
@@ -42,8 +42,8 @@ public class BlockStationary extends BlockFluids {
int l = random.nextInt(3);
// CraftBukkit start: prevent lava putting something on fire.
- Server server = ((WorldServer)world).getServer();
- CraftWorld cworld = ((WorldServer)world).getWorld();
+ Server server = ((WorldServer) world).getServer();
+ CraftWorld cworld = ((WorldServer) world).getWorld();
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
Player thePlayer = null;
@@ -60,7 +60,7 @@ public class BlockStationary extends BlockFluids {
// CraftBukkit start: prevent lava putting something on fire.
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
- if (theBlock.getTypeId() != Block.FIRE.id){
+ if (theBlock.getTypeId() != Block.FIRE.id) {
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 3f71badc..55a8340b 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
+// CraftBukkit
import org.bukkit.craftbukkit.CraftWorld;
public class Chunk {
@@ -47,7 +48,7 @@ public class Chunk {
// CraftBukkit start
CraftWorld cw = ((WorldServer) world).getWorld();
- bukkitChunk = (cw == null) ? null:cw.popPreservedChunk( i, j );
+ bukkitChunk = (cw == null) ? null : cw.popPreservedChunk( i, j );
if (bukkitChunk == null) {
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
}
@@ -358,7 +359,8 @@ public class Chunk {
if (i != this.j || j != this.k) {
System.out.println("Wrong location! " + entity);
- System.out.println("" + entity.locX + "," + entity.locZ + "(" + i + "," + j + ") vs " + this.j + "," + this.k); // CraftBukkit
+ // CraftBukkit
+ System.out.println("" + entity.locX + "," + entity.locZ + "(" + i + "," + j + ") vs " + this.j + "," + this.k);
Thread.dumpStack();
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index 1153e688..ae85702e 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -23,8 +23,8 @@ public class ChunkProviderServer implements IChunkProvider {
private IChunkProvider c;
private IChunkLoader d;
public LongHashtable<Chunk> e = new LongHashtable<Chunk>(); // CraftBukkit
- public List f = new ArrayList(); // Craftbukkit
- public WorldServer g; // Craftbukkit
+ public List f = new ArrayList(); // CraftBukkit
+ public WorldServer g; // CraftBukkit
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.b = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0);
@@ -34,7 +34,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
public boolean a(int i, int j) {
- return this.e.containsKey(i, j); // Craftbukkit - entire method removed
+ return this.e.containsKey(i, j); // CraftBukkit
}
public void c(int i, int j) {
@@ -109,7 +109,7 @@ public class ChunkProviderServer implements IChunkProvider {
return chunk == null ? (this.g.r ? this.d(i, j) : this.b) : chunk;
}
- public Chunk e(int i, int j) { // Craftbukkit - public
+ public Chunk e(int i, int j) { // CraftBukkit - private->public
if (this.d == null) {
return null;
} else {
@@ -128,7 +128,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
- public void a(Chunk chunk) { // Craftbukkit - public
+ public void a(Chunk chunk) { // CraftBukkit - private->public
if (this.d != null) {
try {
this.d.b(this.g, chunk);
@@ -138,7 +138,7 @@ public class ChunkProviderServer implements IChunkProvider {
}
}
- public void b(Chunk chunk) { // Craftbukkit - public
+ public void b(Chunk chunk) { // CraftBukkit - private->public
if (this.d != null) {
try {
chunk.r = this.g.k();
@@ -201,9 +201,9 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = e.get(chunkcoordinates);
if (chunk == null) continue;
- ChunkUnloadEvent cue = new ChunkUnloadEvent(Type.CHUNK_UNLOADED, chunk.bukkitChunk);
- server.getPluginManager().callEvent(cue);
- if (!cue.isCancelled()) {
+ ChunkUnloadEvent event = new ChunkUnloadEvent(Type.CHUNK_UNLOADED, chunk.bukkitChunk);
+ server.getPluginManager().callEvent(event);
+ if (!event.isCancelled()) {
g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
chunk.e();
diff --git a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java
index cdccfa7b..53f125a5 100644
--- a/src/main/java/net/minecraft/server/ConsoleCommandHandler.java
+++ b/src/main/java/net/minecraft/server/ConsoleCommandHandler.java
@@ -17,7 +17,7 @@ public class ConsoleCommandHandler {
String s = servercommand.a;
ICommandListener icommandlistener = servercommand.b;
String s1 = icommandlistener.c();
- WorldServer worldserver = b.worlds.get(0); // Craftbukkit
+ WorldServer worldserver = this.b.worlds.get(0); // CraftBukkit
ServerConfigurationManager serverconfigurationmanager = this.b.f;
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {
diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java
index f3686b53..6de400b4 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogManager.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogManager.java
@@ -2,14 +2,15 @@ package net.minecraft.server;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
-import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.logging.Handler; // CraftBukkit
+
public class ConsoleLogManager {
public static Logger a = Logger.getLogger("Minecraft");
- public static Logger global = Logger.getLogger(""); // Craftbukkit
+ public static Logger global = Logger.getLogger(""); // CraftBukkit
public ConsoleLogManager() {}
@@ -19,24 +20,24 @@ public class ConsoleLogManager {
a.setUseParentHandlers(false);
ConsoleHandler consolehandler = new ConsoleHandler();
- // Craftbukkit start
- for (Handler handler : global.getHandlers()) {
+ // CraftBukkit start
+ for (Handler handler: global.getHandlers()) {
global.removeHandler(handler);
}
- // Craftbukkit end
+ // CraftBukkit end
consolehandler.setFormatter(consolelogformatter);
a.addHandler(consolehandler);
- global.addHandler(consolehandler); // Craftbukkit
+ global.addHandler(consolehandler); // CraftBukkit
try {
FileHandler filehandler = new FileHandler("server.log", true);
filehandler.setFormatter(consolelogformatter);
a.addHandler(filehandler);
- global.addHandler(filehandler); // Craftbukkit
+ global.addHandler(filehandler); // CraftBukkit
} catch (Exception exception) {
a.log(Level.WARNING, "Failed to log to server.log", exception);
}
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 1ce82ac9..5f73ab46 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -68,7 +68,7 @@ public abstract class Entity {
public int ticksLived;
public int maxFireTicks;
public int fireTicks;
- public int maxAirTicks; // Craftbukkit: Make public
+ public int maxAirTicks; // CraftBukkit -- protected->public
protected boolean bv;
public int noDamageTicks;
public int airTicks;
@@ -224,7 +224,7 @@ public abstract class Entity {
if (this.fireTicks % 20 == 0) {
// CraftBukkit start
// TODO: this event spams!
- if(this instanceof EntityLiving) {
+ if (this instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE_TICK;
@@ -233,7 +233,7 @@ public abstract class Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage());
}
} else {
@@ -264,28 +264,28 @@ public abstract class Entity {
protected void P() {
if (!this.by) {
- // CraftBukkit start
- // TODO: this event spams!
- if(this instanceof EntityLiving) {
+ // CraftBukkit start -- TODO: this event spams!
+ if (this instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
// TODO: shouldn't be sending null for the block.
- org.bukkit.block.Block damager = null; //((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
int damageDone = 4;
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+
+ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage());
}
- if(this.fireTicks <= 0){
+ if (this.fireTicks <= 0) {
// not on fire yet
Type eventType = Type.ENTITY_COMBUST;
EntityCombustEvent combustEvent = new EntityCombustEvent(eventType, damagee);
server.getPluginManager().callEvent(combustEvent);
- if (!combustEvent.isCancelled()){
+ if (!combustEvent.isCancelled()) {
this.fireTicks = 600;
}
} else {
@@ -476,10 +476,10 @@ public abstract class Entity {
int i1;
int j1;
- // Craftbukkit start
+ // CraftBukkit start
if ((this.bg) && (getBukkitEntity() instanceof Vehicle)) {
- Vehicle vehicle = (Vehicle)getBukkitEntity();
- org.bukkit.World wrld = ((WorldServer)world).getWorld();
+ Vehicle vehicle = (Vehicle) getBukkitEntity();
+ org.bukkit.World wrld = ((WorldServer) world).getWorld();
org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ));
if (d5 > d0) {
@@ -495,7 +495,7 @@ public abstract class Entity {
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block);
((WorldServer) world).getServer().getPluginManager().callEvent(event);
}
- // Craftbukkit end
+ // CraftBukkit end
if (this.bg && !flag) {
this.bf = (float) ((double) this.bf + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D);
@@ -547,7 +547,7 @@ public abstract class Entity {
if (!flag2) {
++this.fireTicks;
// CraftBukkit start
- if (this.fireTicks <= 0){
+ if (this.fireTicks <= 0) {
// not on fire yet
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
@@ -556,7 +556,7 @@ public abstract class Entity {
EntityCombustEvent event = new EntityCombustEvent(eventType, damagee);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
this.fireTicks = 300;
}
} else {
@@ -602,10 +602,11 @@ public abstract class Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
- this.a((Entity) null, event.getDamage());
+ if (event.isCancelled()) {
+ return;
}
- return;
+
+ i = event.getDamage();
}
// CraftBukkit end
this.a((Entity) null, i);
@@ -843,18 +844,18 @@ public abstract class Entity {
this.airTicks = nbttagcompound.d("Air");
this.onGround = nbttagcompound.m("OnGround");
- // Craftbukkit start
+ // CraftBukkit start
if (nbttagcompound.b("World")) {
String worldName = nbttagcompound.i("World");
- for (WorldServer world : ((WorldServer)this.world).getServer().getServer().worlds) {
+ for (WorldServer world: ((WorldServer) this.world).getServer().getServer().worlds) {
if (world.q.j.equals(worldName)) {
this.world = world;
break;
}
}
}
- // Craftbukkit end
+ // CraftBukkit end
this.a(this.locX, this.locY, this.locZ);
this.b(nbttagcompound);
@@ -1005,7 +1006,7 @@ public abstract class Entity {
protected org.bukkit.entity.Entity bukkitEntity;
- public org.bukkit.entity.Entity getBukkitEntity(){
+ public org.bukkit.entity.Entity getBukkitEntity() {
if (bukkitEntity == null) {
bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(((WorldServer) this.world).getServer(), this);
}
@@ -1021,14 +1022,15 @@ public abstract class Entity {
this.e = 0.0D;
if (entity == null) {
if (this.vehicle != null) {
- // Craftbukkit start
+ // CraftBukkit start
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
- CraftVehicle cvehicle = (CraftVehicle)vehicle.getBukkitEntity();
- LivingEntity living = (LivingEntity)getBukkitEntity();
+ CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
+ LivingEntity living = (LivingEntity) getBukkitEntity();
+
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living);
- ((WorldServer)world).getServer().getPluginManager().callEvent(event);
+ ((WorldServer) world).getServer().getPluginManager().callEvent(event);
}
- // Craftbukkit end
+ // CraftBukkit end
this.c(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null;
@@ -1036,14 +1038,15 @@ public abstract class Entity {
this.vehicle = null;
} else if (this.vehicle == entity) {
- // Craftbukkit start
+ // CraftBukkit start
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
- CraftVehicle cvehicle = (CraftVehicle)vehicle.getBukkitEntity();
- LivingEntity living = (LivingEntity)getBukkitEntity();
+ CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
+ LivingEntity living = (LivingEntity) getBukkitEntity();
+
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living);
- ((WorldServer)world).getServer().getPluginManager().callEvent(event);
+ ((WorldServer) world).getServer().getPluginManager().callEvent(event);
}
- // Craftbukkit end
+ // CraftBukkit end
this.vehicle.passenger = null;
this.vehicle = null;
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 7820aa2b..2beb2e43 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -156,7 +156,7 @@ public class EntityArrow extends Entity {
if (entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer();
- //TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
+ // TODO decide if we should create DamageCause.ARROW, DamageCause.PROJECTILE
// or leave as DamageCause.ENTITY_ATTACK
org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity();
org.bukkit.entity.Entity damagee = movingobjectposition.g.getBukkitEntity();
@@ -167,7 +167,7 @@ public class EntityArrow extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+ if (!event.isCancelled()) {
// this function returns if the arrow should stick in or not, i.e. !bounce
stick = movingobjectposition.g.a(this.b, event.getDamage());
} else {
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index c0412a0c..807ce0f5 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -220,7 +220,8 @@ public class EntityBoat extends Entity {
this.motZ += this.passenger.motZ * 0.2D;
}
- d4 = this.maxSpeed; // CraftBukkit
+ // CraftBukkit
+ d4 = this.maxSpeed;
if (this.motX < -d4) {
this.motX = -d4;
}
@@ -325,7 +326,9 @@ public class EntityBoat extends Entity {
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+
server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle));
+
if (!from.equals(to)) {
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to);
server.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index f5fe8a97..cfd74655 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
public class EntityCreature extends EntityLiving {
- public PathEntity a; // Craftbukkit - public
- public Entity d; // Craftbukkit - public
+ public PathEntity a; // CraftBukkit - public
+ public Entity d; // CraftBukkit - public
protected boolean e = false;
public EntityCreature(World world) {
@@ -29,6 +29,7 @@ public class EntityCreature extends EntityLiving {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.d = null;
@@ -46,6 +47,7 @@ public class EntityCreature extends EntityLiving {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.d = null;
@@ -115,7 +117,8 @@ public class EntityCreature extends EntityLiving {
double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ;
double d3 = vec3d.b - (double) l1;
- float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F; // Craftbukkit
+ // CraftBukkit -- Math -> TrigMath
+ float f4 = (float) (TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f5 = f4 - this.yaw;
for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) {
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index d17d4e56..4268ddd9 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-//CraftBukkit start
+// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent;
@@ -83,18 +83,20 @@ public class EntityCreeper extends EntityMonster {
this.e(1);
++this.a;
if (this.a >= 30) {
- // Craftbukkit start
+ // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
- ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 3.0F, false);
+
+ ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 3.0F, false);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+
+ if (!event.isCancelled()) {
this.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.C();
} else {
this.a = 0;
}
- // Craftbukkit end
+ // CraftBukkit end
}
this.e = true;
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index 6204c9cb..f9044d63 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -167,7 +167,7 @@ public class EntityEgg extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+ if (!event.isCancelled()) {
// this function returns if the egg should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.g, event.getDamage());
} else {
@@ -184,7 +184,7 @@ public class EntityEgg extends Entity {
}
boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0;
- byte numHatching = (this.random.nextInt(32) == 0) ? (byte) 4 : (byte) 1;
+ int numHatching = (this.random.nextInt(32) == 0) ? 4 : 1;
if (!hatching) {
numHatching = 0;
}
@@ -195,8 +195,9 @@ public class EntityEgg extends Entity {
Type eventType = Type.PLAYER_EGG_THROW;
Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity();
- PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg)this.getBukkitEntity(), hatching, numHatching, hatchingType);
+ PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, (Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType);
server.getPluginManager().callEvent(event);
+
hatching = event.isHatching();
numHatching = event.getNumHatches();
hatchingType = event.getHatchType();
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 35608966..04394a38 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -133,7 +133,7 @@ public class EntityFireball extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+ if (!event.isCancelled()) {
// this function returns if the fireball should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.j, event.getDamage());
} else {
@@ -144,20 +144,20 @@ public class EntityFireball extends Entity {
stick = movingobjectposition.g.a(this.j, 0);
}
if (stick) {
- // CraftBukkit end
;
}
}
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
- ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false);
+
+ ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), 1.0F, false);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+ if (!event.isCancelled()) {
this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.C();
}
- // Craftbukkit end
+ // CraftBukkit end
}
this.locX += this.motX;
diff --git a/src/main/java/net/minecraft/server/EntityFish.java b/src/main/java/net/minecraft/server/EntityFish.java
index 82153e35..139ddc8b 100644
--- a/src/main/java/net/minecraft/server/EntityFish.java
+++ b/src/main/java/net/minecraft/server/EntityFish.java
@@ -202,7 +202,7 @@ public class EntityFish extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+ if (!event.isCancelled()) {
// this function returns if the fish should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.b, event.getDamage());
} else {
@@ -213,9 +213,9 @@ public class EntityFish extends Entity {
stick = movingobjectposition.g.a(this.b, 0);
}
if (!stick) {
+ // CraftBukkit end
this.c = movingobjectposition.g;
}
- // CraftBukkit end
} else {
this.h = true;
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 053f8542..54a5219e 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -159,7 +159,8 @@ public abstract class EntityHuman extends EntityLiving {
this.n = this.o;
super.q();
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ);
- float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F; // CraftBukkit
+ // CraftBukkit -- Math -> TrigMath
+ float f1 = (float) TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
if (f > 0.1F) {
f = 0.1F;
@@ -255,9 +256,10 @@ public abstract class EntityHuman extends EntityLiving {
}
// CraftBukkit start
- Player player = (Player)this.getBukkitEntity();
- CraftServer server = ((WorldServer)world).getServer();
+ Player player = (Player) this.getBukkitEntity();
+ CraftServer server = ((WorldServer) world).getServer();
CraftItem drop = new CraftItem(server, entityitem);
+
PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop);
server.getPluginManager().callEvent(event);
@@ -416,21 +418,19 @@ public abstract class EntityHuman extends EntityLiving {
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
- int damageDone = i;
- EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
+ EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, i);
server.getPluginManager().callEvent(event);
- if (event.isCancelled()){
+ if (event.isCancelled()) {
return;
}
- entity.a(this, event.getDamage());
- } else {
- entity.a(this, i);
+ i = event.getDamage();
}
// CraftBukkit end
+ entity.a(this, i);
ItemStack itemstack = this.z();
if (itemstack != null && entity instanceof EntityLiving) {
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 3e00f411..ab283236 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -198,7 +198,7 @@ public class EntityItem extends Entity {
if (this.c == 0) {
Player player = (Player) entityhuman.getBukkitEntity();
PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (Item) this.getBukkitEntity());
- ((WorldServer)world).getServer().getPluginManager().callEvent(event);
+ ((WorldServer) world).getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && entityhuman.inventory.a(this.a)) {
this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index aae79da9..e021be0d 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -124,10 +124,11 @@ public abstract class EntityLiving extends Entity {
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity victim = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.SUFFOCATION;
+
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, 1);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
this.a((Entity) null, 1);
}
// CraftBukkit end
@@ -161,7 +162,7 @@ public abstract class EntityLiving extends Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage());
}
// CraftBukkit end
@@ -239,7 +240,8 @@ public abstract class EntityLiving extends Entity {
if (f > 0.05F) {
f3 = 1.0F;
f2 = f * 3.0F;
- f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; // Craftbukkit
+ // CraftBukkit -- Math -> TrigMath
+ f1 = (float) TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
if (this.V > 0.0F) {
@@ -446,25 +448,26 @@ public abstract class EntityLiving extends Entity {
}
protected void o() {
- // Craftbukkit start - whole method
+ int i = this.h();
+
+ // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
- int drop = this.h();
int count = random.nextInt(3);
- if ((drop > 0) && (count > 0)) {
- loot.add(new org.bukkit.inventory.ItemStack(drop, count));
+ if ((i > 0) && (count > 0)) {
+ loot.add(new org.bukkit.inventory.ItemStack(i, count));
}
- CraftEntity entity = (CraftEntity)getBukkitEntity();
+ CraftEntity entity = (CraftEntity) getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(Type.ENTITY_DEATH, entity, loot);
- CraftWorld cworld = ((WorldServer)world).getWorld();
- Server server = ((WorldServer)world).getServer();
+ CraftWorld cworld = ((WorldServer) world).getWorld();
+ Server server = ((WorldServer) world).getServer();
server.getPluginManager().callEvent(event);
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
+ for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
cworld.dropItemNaturally(entity.getLocation(), stack);
}
- // Craftbukkit end
+ // CraftBukkit end
}
protected int h() {
@@ -479,10 +482,11 @@ public abstract class EntityLiving extends Entity {
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity victim = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.FALL;
+
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, i);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage());
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
index 6f6188d4..44b9b719 100644
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ b/src/main/java/net/minecraft/server/EntityMinecart.java
@@ -47,7 +47,7 @@ public class EntityMinecart extends Entity implements IInventory {
public EntityMinecart(World world) {
super(world);
- this.h = new ItemStack[27]; //Craftbukkit
+ this.h = new ItemStack[27]; // CraftBukkit
this.a = 0;
this.b = 0;
this.c = 1;
@@ -106,11 +106,12 @@ public class EntityMinecart extends Entity implements IInventory {
int damage = i;
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, passenger, damage);
- ((WorldServer)this.world).getServer().getPluginManager().callEvent(event);
+ ((WorldServer) this.world).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
+
i = event.getDamage();
// CraftBukkit end
@@ -225,7 +226,8 @@ public class EntityMinecart extends Entity implements IInventory {
--j;
}
- double d4 = this.maxSpeed; // CraftBukkit
+ // CraftBukkit
+ double d4 = this.maxSpeed;
boolean flag = false;
d0 = 0.0078125D;
@@ -254,7 +256,8 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ -= d0;
}
- int[][] aint = EntityMinecart.j[l]; // CraftBukkit -- be explicit.
+ // CraftBukkit -- be explicit.
+ int[][] aint = EntityMinecart.j[l];
double d5 = (double) (aint[1][0] - aint[0][0]);
double d6 = (double) (aint[1][2] - aint[0][2]);
double d7 = Math.sqrt(d5 * d5 + d6 * d6);
@@ -327,7 +330,8 @@ public class EntityMinecart extends Entity implements IInventory {
this.a(this.locX, this.locY + (double) aint[1][1], this.locZ);
}
- if (this.passenger != null || !slowWhenEmpty) { // Craftbukkit
+ // CraftBukkit
+ if (this.passenger != null || !slowWhenEmpty) {
this.motX *= 0.996999979019165D;
this.motY *= 0.0D;
this.motZ *= 0.996999979019165D;
@@ -464,7 +468,9 @@ public class EntityMinecart extends Entity implements IInventory {
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+
server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle));
+
if (!from.equals(to)) {
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to);
server.getPluginManager().callEvent(event);
@@ -606,7 +612,6 @@ public class EntityMinecart extends Entity implements IInventory {
public void h(Entity entity) {
if (!this.world.isStatic) {
if (entity != this.passenger) {
-
// CraftBukkit start
CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 71e32fb8..9ad79aaf 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -48,13 +48,15 @@ public class EntityMonster extends EntityCreature implements IMonster {
if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) {
// CraftBukkit start
+ CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity bukkitTarget = null;
if (entity != null) {
bukkitTarget = entity.getBukkitEntity();
}
+
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
- CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.d = null;
@@ -83,18 +85,18 @@ public class EntityMonster extends EntityCreature implements IMonster {
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
- int damageDone = this.c;
- EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, damageDone);
+ EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(damager, damagee, damageType, this.c);
server.getPluginManager().callEvent(event);
- if (!event.isCancelled()){
+ if (!event.isCancelled()) {
entity.a(this, event.getDamage());
}
- } else {
- entity.a(this, this.c);
+ return;
}
// CraftBukkit end
+
+ entity.a(this, this.c);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index b9a06e07..5c2b69be 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -76,13 +76,15 @@ public class EntityPigZombie extends EntityZombie {
private void c(Entity entity) {
// CraftBukkit start
+ CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity bukkitTarget = null;
if (entity != null) {
bukkitTarget = entity.getBukkitEntity();
}
+
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
- CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.d = null;
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index e3925116..5c36727d 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -1,17 +1,19 @@
package net.minecraft.server;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
+
+// CraftBukkit start
+import java.util.ArrayList;
import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.Event;
import org.bukkit.event.entity.EntityDeathEvent;
+// CraftBukkit end
public class EntityPlayer extends EntityHuman implements ICrafting {
@@ -86,7 +88,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(Entity entity) {
- // Craftbukkit start
+ // CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
for (int i = 0; i < inventory.a.length; ++i) {
@@ -101,16 +103,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- CraftEntity ent = (CraftEntity)getBukkitEntity();
- EntityDeathEvent event = new EntityDeathEvent(Event.Type.ENTITY_DEATH, ent, loot);
- CraftWorld cworld = ((WorldServer)world).getWorld();
- Server server = ((WorldServer)world).getServer();
+ CraftEntity craftEntity = (CraftEntity) getBukkitEntity();
+ CraftWorld cworld = ((WorldServer) world).getWorld();
+ Server server = ((WorldServer) world).getServer();
+
+ EntityDeathEvent event = new EntityDeathEvent(Event.Type.ENTITY_DEATH, craftEntity, loot);
server.getPluginManager().callEvent(event);
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
- cworld.dropItemNaturally(ent.getLocation(), stack);
+ for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
+ cworld.dropItemNaturally(craftEntity.getLocation(), stack);
}
- // Craftbukkit end
+ // CraftBukkit end
}
public boolean a(Entity entity, int i) {
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index 998d21a3..b0c62ea2 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -42,8 +42,10 @@ public class EntitySkeleton extends EntityMonster {
CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.ENTITY_COMBUST;
org.bukkit.entity.Entity entity = this.getBukkitEntity();
+
EntityCombustEvent event = new EntityCombustEvent(eventType, entity);
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
this.fireTicks = 300;
}
@@ -90,7 +92,7 @@ public class EntitySkeleton extends EntityMonster {
}
protected void o() {
- // Craftbukkit start - whole method
+ // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3);
@@ -103,15 +105,16 @@ public class EntitySkeleton extends EntityMonster {
loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.Material.BONE, count));
}
- CraftEntity entity = (CraftEntity)getBukkitEntity();
+ CraftWorld cworld = ((WorldServer) world).getWorld();
+ Server server = ((WorldServer) world).getServer();
+ CraftEntity entity = (CraftEntity) getBukkitEntity();
+
EntityDeathEvent event = new EntityDeathEvent(Type.ENTITY_DEATH, entity, loot);
- CraftWorld cworld = ((WorldServer)world).getWorld();
- Server server = ((WorldServer)world).getServer();
server.getPluginManager().callEvent(event);
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
+ for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
cworld.dropItemNaturally(entity.getLocation(), stack);
}
- // Craftbukkit end
+ // CraftBukkit end
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java
index fce0b6c7..7fe95631 100644
--- a/src/main/java/net/minecraft/server/EntitySnowball.java
+++ b/src/main/java/net/minecraft/server/EntitySnowball.java
@@ -162,7 +162,7 @@ public class EntitySnowball extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event);
- if(!event.isCancelled()) {
+ if (!event.isCancelled()) {
// this function returns if the snowball should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.g, event.getDamage());
} else {
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 586c68ae..19de8a1e 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -49,9 +49,10 @@ public class EntitySpider extends EntityMonster {
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start
- EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
CraftServer server = ((WorldServer) this.world).getServer();
+ EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
if (event.getTarget() == null) {
this.d = null;
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 8b783812..4adbd862 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -1,6 +1,6 @@
package net.minecraft.server;
-//CraftBukkit start
+// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent;
@@ -55,11 +55,10 @@ public class EntityTNTPrimed extends Entity {
}
if (this.a-- <= 0) {
- // Craftbukkit start
- // Need to reverse the order of the explosion and the entity death so we have a location for the event.
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event.
this.h();
this.C();
- // Craftbukkit end
+ // CraftBukkit end
} else {
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D);
}
@@ -68,15 +67,17 @@ public class EntityTNTPrimed extends Entity {
private void h() {
float f = 4.0F;
- // Craftbukkit start
+ // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
+
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), f, false);
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
this.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
}
- // Craftbukkit end
+ // CraftBukkit end
}
protected void a(NBTTagCompound nbttagcompound) {
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 8cfbf30c..4776bc3b 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -73,7 +73,8 @@ public class EntityTracker {
this.a.add(entitytrackerentry);
this.b.a(entity.id, entitytrackerentry);
- entitytrackerentry.b(entity.world.d); // Craftbukkit
+ // CraftBukkit
+ entitytrackerentry.b(entity.world.d); // CraftBukkit
}
}
@@ -104,7 +105,8 @@ public class EntityTracker {
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
- entitytrackerentry.a(entitytrackerentry.a.world.d); // Craftbukkit
+ // CraftBukkit
+ entitytrackerentry.a(entitytrackerentry.a.world.d);
if (entitytrackerentry.m && entitytrackerentry.a instanceof EntityPlayer) {
arraylist.add((EntityPlayer) entitytrackerentry.a);
}
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index d89e1a09..31784724 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -159,7 +159,8 @@ public class EntityTrackerEntry {
double d1 = entityplayer.locZ - (double) (this.f / 32);
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
- if ((!this.n.contains(entityplayer)) && (this.a.world == entityplayer.world)) { // Craftbukkit
+ // CraftBukkit
+ if ((!this.n.contains(entityplayer)) && (this.a.world == entityplayer.world)) {
this.n.add(entityplayer);
entityplayer.a.b(this.b());
if (this.s) {
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index e14121e6..a3569a2e 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -24,6 +24,7 @@ public class EntityZombie extends EntityMonster {
CraftServer server = ((WorldServer) this.world).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
this.fireTicks = 300;
}
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index a399af92..9f570578 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -30,7 +30,7 @@ public class Explosion {
public float f;
public Set g = new HashSet();
- public boolean wasCanceled = false; // Craftbukkit
+ public boolean wasCanceled = false; // CraftBukkit
public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
this.i = world;
@@ -125,14 +125,16 @@ public class Explosion {
DamageCause damageType;
int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.f + 1.0D);
- if(damagee == null) {
+ if (damagee == null) {
// nothing was hurt
} else if (e == null) { // Block explosion
// TODO: get the x/y/z of the tnt block?
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
+
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event);
+
if (!event.isCancelled()) {
entity.a(this.e, event.getDamage());
entity.motX += d0 * d10;
@@ -187,20 +189,20 @@ public class Explosion {
// CraftBukkit start
Server server = ((WorldServer) this.i).getServer();
CraftWorld world = ((WorldServer) this.i).getWorld();
- org.bukkit.entity.Entity splode = (this.e == null) ? null : this.e.getBukkitEntity();
+ org.bukkit.entity.Entity explode = (this.e == null) ? null : this.e.getBukkitEntity();
Location location = new Location(world, this.b, this.c, this.d);
- List<org.bukkit.block.Block> blocklist = new ArrayList<org.bukkit.block.Block>();
+ List<org.bukkit.block.Block> blockList = new ArrayList<org.bukkit.block.Block>();
for (int j = arraylist.size() - 1; j >= 0; j--) {
ChunkPosition cpos = (ChunkPosition) arraylist.get(j);
- org.bukkit.block.Block blox = world.getBlockAt(cpos.a, cpos.b, cpos.c);
- if (!blox.getType().equals(org.bukkit.Material.AIR)) {
- blocklist.add(blox);
+ org.bukkit.block.Block block = world.getBlockAt(cpos.a, cpos.b, cpos.c);
+ if (!block.getType().equals(org.bukkit.Material.AIR)) {
+ blockList.add(block);
}
}
org.bukkit.event.Event.Type eventType = EntityExplodeEvent.Type.ENTITY_EXPLODE;
- EntityExplodeEvent event = new EntityExplodeEvent(eventType, splode, location, blocklist);
+ EntityExplodeEvent event = new EntityExplodeEvent(eventType, explode, location, blockList);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -239,7 +241,8 @@ public class Explosion {
}
if (i1 > 0) {
- Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield()); // Craftbukkit
+ // CraftBukkit
+ Block.byId[i1].a(this.i, j, k, l, this.i.getData(j, k, l), event.getYield());
this.i.e(j, k, l, 0);
Block.byId[i1].c(this.i, j, k, l);
}
diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/InventoryPlayer.java
index 251ea0bf..30d3ca26 100644
--- a/src/main/java/net/minecraft/server/InventoryPlayer.java
+++ b/src/main/java/net/minecraft/server/InventoryPlayer.java
@@ -5,7 +5,7 @@ public class InventoryPlayer implements IInventory {
public ItemStack[] a = new ItemStack[36];
public ItemStack[] b = new ItemStack[4];
public int c = 0;
- public EntityHuman e; // Craftbukkit - public
+ public EntityHuman e; // CraftBukkit - private->public
private ItemStack f;
public boolean d = false;
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index c1561933..3650a925 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -22,8 +22,7 @@ public class ItemBlock extends Item {
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
- // CraftBukkit start
- // Bail if we have nothing of the item in hand
+ // CraftBukkit start -- Bail if we have nothing of the item in hand
if (itemstack.count == 0) {
return false;
}
@@ -101,7 +100,8 @@ public class ItemBlock extends Item {
int distanceFromSpawn = (int) Math.max(Math.abs(i - spawnX), Math.abs(k - spawnZ));
- boolean canBuild = distanceFromSpawn > ((WorldServer) world).x.spawnProtection || thePlayer.isOp(); // CraftBukkit Configurable spawn protection start
+ // CraftBukkit Configurable spawn protection start
+ boolean canBuild = distanceFromSpawn > ((WorldServer) world).x.spawnProtection || thePlayer.isOp();
BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
server.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java
index df38c5bc..083d2ce3 100644
--- a/src/main/java/net/minecraft/server/ItemInWorldManager.java
+++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java
@@ -103,7 +103,7 @@ public class ItemInWorldManager {
public boolean d(int i, int j, int k) {
// CraftBukkit start
- if (this.a instanceof EntityPlayer){
+ if (this.a instanceof EntityPlayer) {
CraftServer server = ((WorldServer) this.b).getServer();
org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.a.getBukkitEntity();
@@ -111,7 +111,7 @@ public class ItemInWorldManager {
BlockBreakEvent event = new BlockBreakEvent(block,player);
server.getPluginManager().callEvent(event);
- if (event.isCancelled()){
+ if (event.isCancelled()) {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 365b5fc4..2eb10def 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -5,7 +5,7 @@ public final class ItemStack {
public int count;
public int b;
public int id;
- public int damage; // Craftbukkit - make public
+ public int damage; // CraftBukkit - private->public
public ItemStack(Block block) {
this(block, 1);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 36487c3f..3daaa767 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -3,7 +3,6 @@ package net.minecraft.server;
import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.IOException;
-import java.io.PrintStream;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Collections;
@@ -14,6 +13,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
// CraftBukkit start
+import java.io.PrintStream;
import java.net.UnknownHostException;
import joptsimple.OptionSet;
import org.bukkit.command.ConsoleCommandSender;
@@ -22,7 +22,7 @@ import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.event.Event;
import org.bukkit.event.world.WorldEvent;
-//CraftBukkit end
+// CraftBukkit end
public class MinecraftServer implements Runnable, ICommandListener {
@@ -30,7 +30,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public static HashMap b = new HashMap();
public NetworkListenThread c;
public PropertyManager d;
- //public WorldServer e; // Craftbukkit - removed
+ // public WorldServer e; // CraftBukkit - removed
public ServerConfigurationManager f;
private ConsoleCommandHandler o;
private boolean p = true;
@@ -45,7 +45,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public boolean m;
public boolean n;
- // Craftbukkit start
+ // CraftBukkit start
public int spawnProtection;
public List<WorldServer> worlds = new ArrayList<WorldServer>();
public CraftServer server;
@@ -53,7 +53,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public ConsoleCommandSender console;
// Craftbukkit end
- public MinecraftServer(OptionSet options) { // Craftbukkit - adds argument OptionSet
+ public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
new ThreadSleepForever(this);
this.options = options; // CraftBukkit
}
@@ -66,10 +66,10 @@ public class MinecraftServer implements Runnable, ICommandListener {
threadcommandreader.start();
ConsoleLogManager.a();
- // Craftbukkit start
+ // CraftBukkit start
System.setOut(new PrintStream(new LoggerOutputStream(a, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true));
- // Craftbukkit end
+ // CraftBukkit end
a.info("Starting minecraft server version Beta 1.3");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
@@ -78,7 +78,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
}
a.info("Loading properties");
- this.d = new PropertyManager(options); // Craftbukkit
+ this.d = new PropertyManager(options); // CraftBukkit
String s = this.d.a("server-ip", "");
this.l = this.d.a("online-mode", true);
@@ -130,18 +130,18 @@ public class MinecraftServer implements Runnable, ICommandListener {
a.info("Preparing start region");
- // Craftbukkit start
+ // CraftBukkit start
WorldServer world = new WorldServer(this, new ServerNBTManager(new File("."), s, true), s, this.d.a("hellworld", false) ? -1 : 0);
world.a(new WorldManager(this, world));
world.j = this.d.a("spawn-monsters", true) ? 1 : 0;
world.a(this.d.a("spawn-monsters", true), this.m);
this.f.a(world);
worlds.add(world);
- // Craftbukkit end
+ // CraftBukkit end
short short1 = 196;
long i = System.currentTimeMillis();
- ChunkCoordinates chunkcoordinates = worlds.get(0).l(); // Craftbukkit
+ ChunkCoordinates chunkcoordinates = worlds.get(0).l(); // CraftBukkit
for (int j = -short1; j <= short1 && this.p; j += 16) {
for (int k = -short1; k <= short1 && this.p; k += 16) {
@@ -159,15 +159,15 @@ public class MinecraftServer implements Runnable, ICommandListener {
i = l;
}
- // Craftbukkit start
- for (WorldServer worldserver : worlds) {
+ // CraftBukkit start
+ for (WorldServer worldserver: worlds) {
world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
while (world.e() && this.p) {
;
}
}
- // Craftbukkit end
+ // CraftBukkit end
}
}
@@ -190,30 +190,30 @@ public class MinecraftServer implements Runnable, ICommandListener {
private void f() {
a.info("Saving chunks");
- // Craftbukkit start
- for (WorldServer world : worlds) {
+ // CraftBukkit start
+ for (WorldServer world: worlds) {
world.a(true, (IProgressUpdate) null);
world.r();
- Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
- server.getPluginManager().callEvent( worldSaved );
+ WorldEvent event = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
+ server.getPluginManager().callEvent( event );
}
- // Craftbukkit end
+ // CraftBukkit end
}
private void g() {
a.info("Stopping server");
// CraftBukkit start
- if(server != null) {
+ if (server != null) {
server.disablePlugins();
}
- // Craftbukkit end
+ // CraftBukkit end
if (this.f != null) {
this.f.d();
}
- if (this.worlds.size() > 0) { // Craftbukkit
+ if (this.worlds.size() > 0) { // CraftBukkit
this.f();
}
}
@@ -243,7 +243,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
j += l;
i = k;
- if (this.worlds.size() > 0 && this.worlds.get(0).q()) { // Craftbukkit - TODO - Replace with loop?
+ // CraftBukkit - TODO - Replace with loop?
+ if (this.worlds.size() > 0 && this.worlds.get(0).q()) {
this.h();
j = 0L;
} else {
@@ -314,7 +315,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
Vec3D.a();
++this.h;
- // Craftbukkit start
+ // CraftBukkit start
if (this.h % 20 == 0) {
for (int i = 0; i < this.f.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(i);
@@ -324,7 +325,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h);
- for (WorldServer world : worlds) {
+ for (WorldServer world: worlds) {
world.g();
while (world.e()) {
@@ -333,8 +334,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
world.d();
}
- // Craftbukkit end
-
+ // CraftBukkit end
this.c.a();
this.f.b();
this.k.a();
@@ -358,12 +358,12 @@ public class MinecraftServer implements Runnable, ICommandListener {
while (this.r.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.r.remove(0);
- // Craftbukkit start
+ // CraftBukkit start
if (server.dispatchCommand(console, servercommand.a)) {
continue;
}
- // Craftbukkit end
-
+ // CraftBukkit end
+
this.o.a(servercommand);
}
}
@@ -372,7 +372,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
this.q.add(iupdateplayerlistbox);
}
- public static void main(final OptionSet options) { // Craftbukkit - replaces main(String args[])
+ public static void main(final OptionSet options) { // CraftBukkit - replaces main(String args[])
try {
MinecraftServer minecraftserver = new MinecraftServer(options);
diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java
index de7f9379..bdd85f19 100644
--- a/src/main/java/net/minecraft/server/NetLoginHandler.java
+++ b/src/main/java/net/minecraft/server/NetLoginHandler.java
@@ -79,7 +79,7 @@ public class NetLoginHandler extends NetHandler {
a.info(this.b() + " logged in with entity id " + entityplayer.id);
NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer);
- // Craftbukkit start
+ // CraftBukkit start
ChunkCoordinates chunkcoordinates = entityplayer.world.l();
netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (byte) entityplayer.world.m.g)));
netserverhandler.b((Packet) (new Packet6SpawnPosition(chunkcoordinates.a, chunkcoordinates.b, chunkcoordinates.c)));
@@ -88,7 +88,7 @@ public class NetLoginHandler extends NetHandler {
netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.e.c.a(netserverhandler);
netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k())));
- // Craftbukkit end
+ // CraftBukkit end
entityplayer.l();
}
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java
index 408b980a..b49d8765 100644
--- a/src/main/java/net/minecraft/server/NetServerHandler.java
+++ b/src/main/java/net/minecraft/server/NetServerHandler.java
@@ -3,10 +3,10 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
-import java.util.logging.Level;
import java.util.logging.Logger;
// CraftBukkit start
+import java.util.logging.Level;
import org.bukkit.ChatColor;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockDamageLevel;
@@ -29,7 +29,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public NetworkManager b;
public boolean c = false;
private MinecraftServer d;
- public EntityPlayer e; // Craftbukkit - public
+ public EntityPlayer e; // CraftBukkit - private->public
private int f;
private int g;
private boolean h;
@@ -76,16 +76,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s) {
// CraftBukkit start
String leaveMessage = "\u00A7e" + this.e.name + " left the game.";
- PlayerKickEvent kickEvent = new PlayerKickEvent(org.bukkit.event.Event.Type.PLAYER_KICK, server.getPlayer(this.e), s, leaveMessage);
- server.getPluginManager().callEvent(kickEvent);
- if (kickEvent.isCancelled()) {
+ PlayerKickEvent event = new PlayerKickEvent(org.bukkit.event.Event.Type.PLAYER_KICK, server.getPlayer(this.e), s, leaveMessage);
+ server.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
// Do not kick the player
return;
}
// Send the possibly modified leave message
- this.b.a((Packet) (new Packet255KickDisconnect( kickEvent.getReason() )));
+ this.b.a((Packet) (new Packet255KickDisconnect( event.getReason() )));
this.b.c();
- this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() )));
+ this.d.f.a((Packet) (new Packet3Chat( event.getLeaveMessage() )));
// CraftBukkit end
this.d.f.c(this.e);
this.c = true;
@@ -159,7 +159,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.motX = d5;
this.e.motZ = d4;
if (this.e.vehicle != null) {
- ((WorldServer)this.e.world).b(this.e.vehicle, true); // Craftbukkit
+ // CraftBukkit
+ ((WorldServer) this.e.world).b(this.e.vehicle, true);
}
if (this.e.vehicle != null) {
@@ -170,7 +171,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.i = this.e.locX;
this.j = this.e.locY;
this.k = this.e.locZ;
- this.e.world.f(this.e); // Craftbukkit
+ // CraftBukkit
+ this.e.world.f(this.e);
return;
}
@@ -211,7 +213,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d6 = d2 - this.e.locY;
double d7 = d3 - this.e.locZ;
float f4 = 0.0625F;
- boolean flag = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; // Craftbukkit
+ // CraftBukkit
+ boolean flag = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0;
this.e.c(d4, d6, d7);
d4 = d1 - this.e.locX;
@@ -232,7 +235,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
this.e.b(d1, d2, d3, f2, f3);
- boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; // Craftbukkit
+ // CraftBukkit
+ boolean flag2 = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0;
if (flag && (flag1 || !flag2) && !this.e.E()) {
this.a(this.i, this.j, this.k, f2, f3);
@@ -275,7 +279,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (packet14blockdig.e == 4) {
this.e.y();
} else {
- boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
+ // CraftBukkit
+ boolean flag = ((WorldServer) this.e.world).v = this.d.f.h(this.e.name);
boolean flag1 = false;
if (packet14blockdig.e == 0) {
@@ -301,7 +306,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
- ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit
+ // CraftBukkit
+ ChunkCoordinates chunkcoordinates = this.e.world.l();
int l = (int) MathHelper.e((float) (i - chunkcoordinates.a));
int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
@@ -315,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int blockId = block.getTypeId();
float damage = 0;
if (Block.byId[blockId] != null) {
- damage = Block.byId[blockId].a(player.getHandle()); //Get amount of damage going to block
+ damage = Block.byId[blockId].a(player.getHandle()); // Get amount of damage going to block
}
// CraftBukkit end
@@ -343,7 +349,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
}
- // CraftBukkit end
} else if (packet14blockdig.e == 2) {
// CraftBukkit start - Get last block that the player hit
// Otherwise the block is a Bedrock @(0,0,0)
@@ -360,7 +365,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
BlockDamageEvent event;
// If the amount of damage going to the block plus the current amount
// of damage is greater than 1, the block is going to break.
- if (e.c.c + damage >= 1.0F) {
+ if (this.e.c.c + damage >= 1.0F) {
// if we are destroying either a redstone wire with a current greater than 0 or
// a redstone torch that is on, then we should notify plugins that this block has
// returned to a current value of 0 (since it will once the redstone is destroyed)
@@ -373,9 +378,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
- e.c.c = 0; // Reset the amount of damage if stopping break.
+ this.e.c.c = 0; // Reset the amount of damage if stopping break.
}
}
+ // CraftBukkit end
} else if (packet14blockdig.e == 3) {
double d4 = this.e.locX - ((double) i + 0.5D);
double d5 = this.e.locY - ((double) j + 0.5D);
@@ -383,24 +389,26 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d7 = d4 * d4 + d5 * d5 + d6 * d6;
if (d7 < 256.0D) {
+ // CraftBukkit
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
}
}
+ // CraftBukkit start
lastX = i;
lastY = j;
lastZ = k;
- ((WorldServer)this.e.world).v = false;
+ ((WorldServer) this.e.world).v = false;
// CraftBukkit end
}
}
public void a(Packet15Place packet15place) {
ItemStack itemstack = this.e.inventory.b();
- boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
-
// CraftBukkit start
+ boolean flag = ((WorldServer) this.e.world).v = this.d.f.h(this.e.name);
+
CraftBlock blockClicked = null;
BlockFace blockFace = null;
@@ -415,7 +423,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
lastMaterial = 0;
} else {
// CraftBukkit RIGHTCLICK or BLOCK_PLACE .. or nothing
- blockClicked = (CraftBlock) ((WorldServer)e.world).getWorld().getBlockAt(packet15place.a, packet15place.b, packet15place.c);
+ blockClicked = (CraftBlock) ((WorldServer) e.world).getWorld().getBlockAt(packet15place.a, packet15place.b, packet15place.c);
lastRightClicked = blockClicked;
lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.id;
}
@@ -471,7 +479,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int j = packet15place.b;
int k = packet15place.c;
int l = packet15place.d;
- ChunkCoordinates chunkcoordinates = this.e.world.l(); // Craftbukkit
+ // CraftBukkit
+ ChunkCoordinates chunkcoordinates = this.e.world.l();
int i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a));
int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
@@ -488,7 +497,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.c.a(this.e, this.e.world, itemstack, i, j, k, l);
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
// CraftBukkit end
-
if (l == 0) {
--j;
}
@@ -513,7 +521,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
++i;
}
- this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); // Craftbukkit
+ // CraftBukkit
+ this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
}
if (itemstack != null && itemstack.count == 0) {
@@ -527,11 +536,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.activeContainer.a();
this.e.h = false;
- if (!ItemStack.a(this.e.inventory.b(), packet15place.e) || always) { // CraftBukkit
+ // CraftBukkit
+ if (!ItemStack.a(this.e.inventory.b(), packet15place.e) || always) {
this.b((Packet) (new Packet103SetSlot(this.e.activeContainer.f, slot.a, this.e.inventory.b())));
}
- ((WorldServer)this.e.world).v = false; // Craftbukkit
+ // CraftBukkit
+ ((WorldServer) this.e.world).v = false;
}
public void a(String s, Object[] aobject) {
@@ -552,10 +563,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
- // Craftbukkit start
+ // CraftBukkit start
PlayerItemHeldEvent event = new PlayerItemHeldEvent(Type.PLAYER_ITEM_HELD, getPlayer(), e.inventory.c, packet16blockitemswitch.a);
server.getPluginManager().callEvent(event);
- // Craftbukkit end
+ // CraftBukkit end
this.e.inventory.c = packet16blockitemswitch.a;
}
@@ -575,11 +586,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
}
- chat(s); // CraftBukkit
+ // CraftBukkit start
+ chat(s);
}
}
- // CraftBukkit start
public boolean chat(String msg) {
if (msg.startsWith("/")) {
this.c(msg);
@@ -589,11 +600,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Player player = getPlayer();
PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_CHAT, player, msg);
server.getPluginManager().callEvent(event);
- msg = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
+
if (event.isCancelled()) {
return true;
}
+ msg = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
a.info(msg);
for (final String line: TextWrapper.wrapText(msg)) {
this.d.f.a((Packet) (new Packet3Chat(line)));
@@ -632,10 +644,11 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// Legacy command handler
event = new PlayerChatEvent(Type.PLAYER_COMMAND, player, s);
server.getPluginManager().callEvent(event);
+
if (event.isCancelled()) {
return;
}
-
+
s = event.getMessage();
player = (CraftPlayer) event.getPlayer();
EntityPlayer e = player.getHandle();
@@ -724,7 +737,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet7UseEntity packet7useentity) {
- Entity entity = ((WorldServer)this.e.world).a(packet7useentity.b); // Craftbukkit
+ // CraftBukkit
+ Entity entity = ((WorldServer) this.e.world).a(packet7useentity.b);
if (entity != null && this.e.e(entity) && this.e.f(entity) < 4.0F) {
if (packet7useentity.c == 0) {
@@ -741,7 +755,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start
CraftPlayer player = getPlayer();
- player.setHandle(e);
+ player.setHandle(this.e);
// CraftBukkit end
}
}
@@ -784,8 +798,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
}
public void a(Packet130UpdateSign packet130updatesign) {
- if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) { // Craftbukkit
- TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c); // Craftbukkit
+ // CraftBukkit start
+ if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) {
+ TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c);
+ // CraftBukkit end
int i;
int j;
@@ -817,23 +833,25 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start - SIGN_CHANGE hook
Player player = server.getPlayer(this.e);
- SignChangeEvent modifyEvent = new SignChangeEvent(org.bukkit.event.Event.Type.SIGN_CHANGE, (CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d);
- server.getPluginManager().callEvent(modifyEvent);
- if (modifyEvent.isCancelled()) {
+ SignChangeEvent event = new SignChangeEvent(org.bukkit.event.Event.Type.SIGN_CHANGE, (CraftBlock) player.getWorld().getBlockAt(i, k, j), server.getPlayer(this.e), packet130updatesign.d);
+ server.getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
// Normally we would return here, but we have to update the sign with blank text if it's been cancelled
// Otherwise the client will have bad text on their sign (client shows text changes as they type)
- for(int l = 0; l < 4; ++l) {
- modifyEvent.setLine(l, "");
+ for (int l = 0; l < 4; ++l) {
+ event.setLine(l, "");
}
}
// CraftBukkit end
for (int l = 0; l < 4; ++l) {
- tileentitysign.a[l] = modifyEvent.getLine(l); // CraftBukkit
+ tileentitysign.a[l] = event.getLine(l);
+ // CraftBukkit
}
tileentitysign.h();
- this.e.world.g(i, k, j); // Craftbukkit
+ this.e.world.g(i, k, j); // CraftBukkit
}
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerInstance.java b/src/main/java/net/minecraft/server/PlayerInstance.java
index 7e326b0a..5b3734ec 100644
--- a/src/main/java/net/minecraft/server/PlayerInstance.java
+++ b/src/main/java/net/minecraft/server/PlayerInstance.java
@@ -29,7 +29,8 @@ class PlayerInstance {
this.d = j;
this.e = new ChunkCoordIntPair(i, j);
- playermanager.world.u.d(i, j); // Craftbukkit
+ // CraftBukkit
+ playermanager.world.u.d(i, j);
}
public void a(EntityPlayer entityplayer) {
@@ -56,7 +57,8 @@ class PlayerInstance {
PlayerManager.c(this.a).remove(this);
}
- ((WorldServer)entityplayer.world).u.c(this.c, this.d); // Craftbukkit
+ // CraftBukkit
+ ((WorldServer) entityplayer.world).u.c(this.c, this.d);
}
entityplayer.f.remove(this.e);
@@ -132,12 +134,12 @@ class PlayerInstance {
j = this.j;
k = this.d * 16 + this.l;
- // Craftbukkit start
+ // CraftBukkit start
this.a((Packet) (new Packet53BlockChange(i, j, k, a.world)));
if (Block.p[a.world.getTypeId(i, j, k)]) {
this.a(a.world.getTileEntity(i, j, k));
}
- // Craftbukkit end
+ // CraftBukkit end
} else {
int l;
@@ -151,23 +153,28 @@ class PlayerInstance {
int i1 = this.k - this.j + 2;
int j1 = this.m - this.l + 1;
- this.a((Packet) (new Packet51MapChunk(i, j, k, l, i1, j1, a.world))); // Craftbukkit
- List list = a.world.d(i, j, k, i + l, j + i1, k + j1); // Craftbukkit
+ // CraftBukkit start
+ this.a((Packet) (new Packet51MapChunk(i, j, k, l, i1, j1, a.world)));
+ List list = a.world.d(i, j, k, i + l, j + i1, k + j1);
+ // CraftBukkit end
for (int k1 = 0; k1 < list.size(); ++k1) {
this.a((TileEntity) list.get(k1));
}
} else {
- this.a((Packet) (new Packet52MultiBlockChange(this.c, this.d, this.f, this.g, a.world))); // Craftbukkit
+ // CraftBukkit
+ this.a((Packet) (new Packet52MultiBlockChange(this.c, this.d, this.f, this.g, a.world)));
for (i = 0; i < this.g; ++i) {
j = this.c * 16 + (this.g >> 12 & 15);
k = this.g & 255;
l = this.d * 16 + (this.g >> 8 & 15);
- if (Block.p[a.world.getTypeId(j, k, l)]) { // Craftbukkit
+ // CraftBukkit start
+ if (Block.p[a.world.getTypeId(j, k, l)]) {
System.out.println("Sending!");
- this.a(a.world.getTileEntity(j, k, l)); // Craftbukkit
+ this.a(a.world.getTileEntity(j, k, l));
}
+ // CraftBukkit end
}
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java
index 0693928f..6a8311cd 100644
--- a/src/main/java/net/minecraft/server/PlayerManager.java
+++ b/src/main/java/net/minecraft/server/PlayerManager.java
@@ -10,14 +10,16 @@ public class PlayerManager {
private List c = new ArrayList();
private MinecraftServer d;
private final int[][] e = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
- public WorldServer world; // Craftbukkit
- // Craftbukkit - change of method signature
+ // CraftBukkit start
+ public WorldServer world;
+
+ // CraftBukkit - change of method signature
public PlayerManager(MinecraftServer minecraftserver, WorldServer world) {
this.d = minecraftserver;
-
- this.world = world; // Craftbukkit
+ this.world = world;
}
+ // CraftBukkit end
public void a() {
for (int i = 0; i < this.c.size(); ++i) {
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index ef7569d2..58092bfe 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -34,14 +34,14 @@ public class PropertyManager {
private OptionSet options = null;
public PropertyManager(final OptionSet options) {
- this((File)options.valueOf("config"));
+ this((File) options.valueOf("config"));
this.options = options;
}
private <T> T getOverride(String name, T value) {
if ((options != null) && (options.has(name))) {
- return (T)options.valueOf(name);
+ return (T) options.valueOf(name);
}
return value;
diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
index 961caad4..a1986bf1 100644
--- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java
+++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java
@@ -29,9 +29,9 @@ public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft");
public List b = new ArrayList();
- public MinecraftServer c; // Craftbukkit - public
- // public PlayerManager d; // Craftbukkit - removed!
- public int e; // Craftbukkit - public
+ public MinecraftServer c; // CraftBukkit - private->public
+ // public PlayerManager d; // CraftBukkit - removed!
+ public int e; // CraftBukkit - private->public
private Set f = new HashSet();
private Set g = new HashSet();
private Set h = new HashSet();
@@ -57,7 +57,7 @@ public class ServerConfigurationManager {
this.k = minecraftserver.a("banned-ips.txt");
this.l = minecraftserver.a("ops.txt");
this.m = minecraftserver.a("white-list.txt");
- // this.d = new PlayerManager(minecraftserver); // Craftbukkit - removed!
+ // this.d = new PlayerManager(minecraftserver); // CraftBukkit - removed!
this.e = minecraftserver.d.a("max-players", 20);
this.o = minecraftserver.d.a("white-list", false);
this.g();
@@ -71,23 +71,22 @@ public class ServerConfigurationManager {
}
public void a(WorldServer worldserver) {
- // Craftbukkit start
+ // CraftBukkit start
if (this.n == null) {
this.n = worldserver.m().d();
}
- // Craftbukkit end
+ // CraftBukkit end
}
public int a() {
- return 144; // Craftbukkit - magic number from PlayerManager.b() (??)
+ return 144; // CraftBukkit - magic number from PlayerManager.b() (??)
}
public void a(EntityPlayer entityplayer) {
this.b.add(entityplayer);
this.n.b(entityplayer);
-
- // Craftbukkit start
- ((WorldServer)entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
+ // CraftBukkit start
+ ((WorldServer) entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) {
entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
@@ -97,21 +96,21 @@ public class ServerConfigurationManager {
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayer)));
- ((WorldServer)entityplayer.world).manager.a(entityplayer);
- // Craftbukkit end
+ ((WorldServer) entityplayer.world).manager.a(entityplayer);
+ // CraftBukkit end
}
public void b(EntityPlayer entityplayer) {
- ((WorldServer)entityplayer.world).manager.c(entityplayer); // Craftbukkit
+ ((WorldServer) entityplayer.world).manager.c(entityplayer); // CraftBukkit
}
public void c(EntityPlayer entityplayer) {
this.n.a(entityplayer);
- entityplayer.world.d(entityplayer); // Craftbukkit
+ entityplayer.world.d(entityplayer); // CraftBukkit
this.b.remove(entityplayer);
// CraftBukkit start
- ((WorldServer)entityplayer.world).manager.b(entityplayer);
+ ((WorldServer) entityplayer.world).manager.b(entityplayer);
server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayer))); // CraftBukkit
// CraftBukkit end
}
@@ -159,17 +158,17 @@ public class ServerConfigurationManager {
}
public EntityPlayer d(EntityPlayer entityplayer) {
- // Craftbukkit start - every reference to this.c.e should be entityplayer.world
+ // CraftBukkit start - every reference to this.c.e should be entityplayer.world
this.c.k.a(entityplayer);
this.c.k.b(entityplayer);
- ((WorldServer)entityplayer.world).manager.b(entityplayer);
+ ((WorldServer) entityplayer.world).manager.b(entityplayer);
this.b.remove(entityplayer);
entityplayer.world.e(entityplayer);
EntityPlayer entityplayer1 = new EntityPlayer(this.c, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
entityplayer1.id = entityplayer.id;
entityplayer1.a = entityplayer.a;
- ((WorldServer)entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
+ ((WorldServer) entityplayer.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
@@ -178,42 +177,46 @@ public class ServerConfigurationManager {
// CraftBukkit start
Player respawnPlayer = server.getPlayer(entityplayer);
Location respawnLocation = new Location(respawnPlayer.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
+
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(Event.Type.PLAYER_RESPAWN, respawnPlayer, respawnLocation );
server.getPluginManager().callEvent(respawnEvent);
- entityplayer1.world = ((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle();
+
+ entityplayer1.world = ((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle();
entityplayer1.locX = respawnEvent.getRespawnLocation().getX();
entityplayer1.locY = respawnEvent.getRespawnLocation().getY();
entityplayer1.locZ = respawnEvent.getRespawnLocation().getZ();
entityplayer1.yaw = respawnEvent.getRespawnLocation().getYaw();
entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch();
- entityplayer1.c = new ItemInWorldManager(((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle());
+ entityplayer1.c = new ItemInWorldManager(((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle());
entityplayer1.c.a = entityplayer1;
- ((WorldServer)entityplayer1.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
+ ((WorldServer) entityplayer1.world).u.d((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
// CraftBukkit end
entityplayer1.a.b((Packet) (new Packet9Respawn()));
entityplayer1.a.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch);
- ((WorldServer)entityplayer1.world).manager.a(entityplayer1);
+ // CraftBukkit start
+ ((WorldServer) entityplayer1.world).manager.a(entityplayer1);
entityplayer.world.a(entityplayer1);
+ // CraftBukkit end
this.b.add(entityplayer1);
entityplayer1.l();
entityplayer1.s();
return entityplayer1;
- // Craftbukkit end
}
public void b() {
- // Craftbukkit start
- for (WorldServer world : c.worlds) {
+ // CraftBukkit start
+ for (WorldServer world: c.worlds) {
world.manager.a();
}
- // Craftbukkit end
+ // CraftBukkit end
}
- // Craftbukkit - changed signature
+ // CraftBukkit start - changed signature
public void a(int i, int j, int k, WorldServer world) {
world.manager.a(i, j, k);
}
+ // CraftBukkit end
public void a(Packet packet) {
for (int i = 0; i < this.b.size(); ++i) {
@@ -489,4 +492,4 @@ public class ServerConfigurationManager {
public void f() {
this.m();
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index f5d99249..e1d05766 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -2,7 +2,7 @@ package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory {
- private ItemStack[] a = new ItemStack[27]; //Craftbukkit
+ private ItemStack[] a = new ItemStack[27]; // CraftBukkit
// CraftBukkit start
public ItemStack[] getContents() {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 76e7d146..c990a9d6 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -359,6 +359,7 @@ public class World implements IBlockAccess {
if (world != null) {
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l);
((WorldServer) this).getServer().getPluginManager().callEvent(event);
+
if (event.isCancelled()) {
return;
}
@@ -712,7 +713,7 @@ public class World implements IBlockAccess {
flag = true;
}
- //CraftBukkit start
+ // CraftBukkit start
if (entity instanceof EntityLiving) {
MobType type = null;
@@ -742,14 +743,13 @@ public class World implements IBlockAccess {
}
if (type != null) {
- CraftServer server = ((WorldServer)this).getServer();
+ CraftServer server = ((WorldServer) this).getServer();
Location loc = new Location(((WorldServer) this).getWorld(), entity.bi, entity.bj, entity.bk);
- CreatureSpawnEvent cse;
- cse = new CreatureSpawnEvent(entity.getBukkitEntity(), type, loc);
- server.getPluginManager().callEvent(cse);
+ CreatureSpawnEvent event = new CreatureSpawnEvent(entity.getBukkitEntity(), type, loc);
+ server.getPluginManager().callEvent(event);
- if (cse.isCancelled()) {
+ if (event.isCancelled()) {
return false;
}
}
@@ -1408,8 +1408,9 @@ public class World implements IBlockAccess {
}
// CraftBukkit start -- Only call spawner if we have players online and the world allows for mobs or animals
- if ((this.D || this.E) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0))
+ if ((this.D || this.E) && (this instanceof WorldServer && ((WorldServer) this).getServer().getHandle().b.size() > 0)) {
SpawnerCreature.a(this, this.D, this.E);
+ }
// CraftBukkit end
this.o.a();
@@ -1621,7 +1622,7 @@ public class World implements IBlockAccess {
axisalignedbb = null;
}
- // Craftbukkit start - We dont want to allow the user to override the bounding box check
+ // CraftBukkit start - We dont want to allow the user to override the bounding box check
boolean defaultReturn = axisalignedbb != null && !this.a(axisalignedbb) ? false : (block != Block.WATER && block != Block.STATIONARY_WATER && block != Block.LAVA && block != Block.STATIONARY_LAVA && block != Block.FIRE && block != Block.SNOW ? i > 0 && block == null && block1.a(this, j, k, l) : true);
if (!defaultReturn) {
diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java
index 6013d625..693b371d 100644
--- a/src/main/java/net/minecraft/server/WorldGenBigTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java
@@ -2,17 +2,15 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
+// CraftBukkit
import org.bukkit.BlockChangeDelegate;
-// CraftBukkit end
public class WorldGenBigTree extends WorldGenerator {
static final byte[] a = new byte[] { (byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1};
Random b = new Random();
- // CraftBukkit start
+ // CraftBukkit
BlockChangeDelegate c;
- // CraftBukkit end
int[] d = new int[] { 0, 0, 0};
int e = 0;
int f;
@@ -344,7 +342,7 @@ public class WorldGenBigTree extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events
- return generate((BlockChangeDelegate)world, random, i, j, k);
+ return generate((BlockChangeDelegate) world, random, i, j, k);
}
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java
index 8ea1b9be..3cccabbb 100644
--- a/src/main/java/net/minecraft/server/WorldGenForest.java
+++ b/src/main/java/net/minecraft/server/WorldGenForest.java
@@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
+// CraftBukkit
import org.bukkit.BlockChangeDelegate;
-// CraftBukkit end
public class WorldGenForest extends WorldGenerator {
@@ -16,7 +15,7 @@ public class WorldGenForest extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events
- return generate((BlockChangeDelegate)world, random, i, j, k);
+ return generate((BlockChangeDelegate) world, random, i, j, k);
}
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga1.java b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
index f1395932..cf03e450 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga1.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
@@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
+// CraftBukkit
import org.bukkit.BlockChangeDelegate;
-// CraftBukkit end
public class WorldGenTaiga1 extends WorldGenerator {
@@ -16,7 +15,7 @@ public class WorldGenTaiga1 extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events
- return generate((BlockChangeDelegate)world, random, i, j, k);
+ return generate((BlockChangeDelegate) world, random, i, j, k);
}
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
index 94dfa9a8..7af3f12d 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
@@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
+// CraftBukkit
import org.bukkit.BlockChangeDelegate;
-// CraftBukkit end
public class WorldGenTaiga2 extends WorldGenerator {
@@ -16,7 +15,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events
- return generate((BlockChangeDelegate)world, random, i, j, k);
+ return generate((BlockChangeDelegate) world, random, i, j, k);
}
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java
index 22f6d416..93142cdb 100644
--- a/src/main/java/net/minecraft/server/WorldGenTrees.java
+++ b/src/main/java/net/minecraft/server/WorldGenTrees.java
@@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random;
-// CraftBukkit start
+// CraftBukkit
import org.bukkit.BlockChangeDelegate;
-// CraftBukkit end
public class WorldGenTrees extends WorldGenerator {
@@ -16,7 +15,7 @@ public class WorldGenTrees extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events
- return generate((BlockChangeDelegate)world, random, i, j, k);
+ return generate((BlockChangeDelegate) world, random, i, j, k);
}
public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {
diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java
index 8fc2b32d..d96c1699 100644
--- a/src/main/java/net/minecraft/server/WorldManager.java
+++ b/src/main/java/net/minecraft/server/WorldManager.java
@@ -3,12 +3,12 @@ package net.minecraft.server;
public class WorldManager implements IWorldAccess {
private MinecraftServer a;
- public WorldServer world; // Craftbukkit
+ public WorldServer world; // CraftBukkit
- // Craftbukkit - changed signature
+ // CraftBukkit - changed signature
public WorldManager(MinecraftServer minecraftserver, WorldServer world) {
this.a = minecraftserver;
- this.world = world; // Craftbukkit
+ this.world = world; // CraftBukkit
}
public void a(String s, double d0, double d1, double d2, double d3, double d4, double d5) {}
@@ -28,7 +28,8 @@ public class WorldManager implements IWorldAccess {
public void a() {}
public void a(int i, int j, int k) {
- this.a.f.a(i, j, k, world); // Craftbukkit
+ // CraftBukkit
+ this.a.f.a(i, j, k, world);
}
public void a(String s, int i, int j, int k) {}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 8177e7e7..157170c4 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1,11 +1,11 @@
package net.minecraft.server;
-import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
// CraftBukkit start
+import java.io.File;
import org.bukkit.BlockChangeDelegate;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
@@ -16,9 +16,9 @@ public class WorldServer extends World implements BlockChangeDelegate {
public ChunkProviderServer u;
public boolean v = false;
public boolean w;
- public final MinecraftServer x; // Craftbukkit - private -> public final
+ public final MinecraftServer x; // CraftBukkit - private -> public final
private EntityList y = new EntityList();
- public PlayerManager manager; // Craftbukkit
+ public PlayerManager manager; // CraftBukkit
public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) {
super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i));
@@ -87,7 +87,8 @@ public class WorldServer extends World implements BlockChangeDelegate {
i1 = l;
}
- return i1 > this.x.spawnProtection || this.x.f.h(entityhuman.name); // CraftBukkit Configurable spawn protection start
+ // CraftBukkit -- Configurable spawn protection
+ return i1 > this.x.spawnProtection || this.x.f.h(entityhuman.name);
}
protected void b(Entity entity) {
@@ -113,11 +114,11 @@ public class WorldServer extends World implements BlockChangeDelegate {
public Explosion a(Entity entity, double d0, double d1, double d2, float f, boolean flag) {
Explosion explosion = super.a(entity, d0, d1, d2, f, flag);
- // Craftbukkit start
- if(explosion.wasCanceled) {
+ // CraftBukkit start
+ if (explosion.wasCanceled) {
return explosion;
}
- // Craftbukkit end
+ // CraftBukkit end
this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
return explosion;