3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-17 05:20:05 +01:00

Generic code cleanup

Dieser Commit ist enthalten in:
Erik Broes 2011-02-23 13:56:36 +01:00
Ursprung 332d9c4f18
Commit 09aa37fe4a
57 geänderte Dateien mit 415 neuen und 344 gelöschten Zeilen

Datei anzeigen

@ -148,7 +148,7 @@ public class BlockButton extends Block {
if (j1 == 0) { if (j1 == 0) {
return true; return true;
} else { } else {
// Craftbukkit start // CraftBukkit start
int old = (j1 != 8) ? 1 : 0; int old = (j1 != 8) ? 1 : 0;
int current = (j1 == 8) ? 1 : 0; int current = (j1 == 8) ? 1 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
@ -156,7 +156,7 @@ public class BlockButton extends Block {
if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) { if ((eventRedstone.getNewCurrent() > 0) != (j1 == 8)) {
return true; return true;
} }
// Craftbukkit end // CraftBukkit end
world.c(i, j, k, i1 + j1); world.c(i, j, k, i1 + j1);
world.b(i, j, k, i, j, k); world.b(i, j, k, i, j, k);
@ -227,14 +227,14 @@ public class BlockButton extends Block {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if ((l & 8) != 0) { if ((l & 8) != 0) {
// Craftbukkit start // CraftBukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
server.getPluginManager().callEvent(eventRedstone); server.getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) return; if (eventRedstone.getNewCurrent() > 0) return;
// Craftbukkit end // CraftBukkit end
world.c(i, j, k, l & 7); world.c(i, j, k, l & 7);
world.h(i, j, k, this.id); world.h(i, j, k, this.id);

Datei anzeigen

@ -80,17 +80,17 @@ public class BlockCactus extends Block {
public void a(World world, int i, int j, int k, Entity entity) { public void a(World world, int i, int j, int k, Entity entity) {
// CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event // CraftBukkit start - ENTITY_DAMAGEBY_BLOCK event
if(entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k); 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; DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT;
int damageDone = 1; int damageDone = 1;
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
entity.a((Entity) null, event.getDamage()); entity.a((Entity) null, event.getDamage());
} }
return; return;

Datei anzeigen

@ -67,7 +67,7 @@ public class BlockDispenser extends BlockContainer {
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.BLOCK_INTERACT; Type eventType = Type.BLOCK_INTERACT;
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); 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); BlockInteractEvent event = new BlockInteractEvent(eventType, block, who);
server.getPluginManager().callEvent(event); 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) { public void b(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
float f = 0.0F; float f = 0.0F;

Datei anzeigen

@ -61,7 +61,8 @@ public class BlockFire extends Block {
if (!world.d(i, j - 1, k) || l > 3) { if (!world.d(i, j - 1, k) || l > 3) {
world.e(i, j, k, 0); 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); world.e(i, j, k, 0);
} else { } else {
if (l % 2 == 0 && l > 2) { if (l % 2 == 0 && l > 2) {
@ -73,8 +74,8 @@ public class BlockFire extends Block {
this.a(world, i, j, k + 1, 300, random); this.a(world, i, j, k + 1, 300, random);
// CraftBukkit start - Call to stop spread of fire. // CraftBukkit start - Call to stop spread of fire.
Server server = ((WorldServer)world).getServer(); Server server = ((WorldServer) world).getServer();
CraftWorld cworld = ((WorldServer)world).getWorld(); CraftWorld cworld = ((WorldServer) world).getWorld();
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD; IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
Player thePlayer = null; Player thePlayer = null;
@ -94,9 +95,9 @@ public class BlockFire extends Block {
if (i2 > 0 && random.nextInt(l1) <= i2) { if (i2 > 0 && random.nextInt(l1) <= i2) {
// CraftBukkit start - Call to stop spread of fire. // 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); BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -130,12 +131,12 @@ public class BlockFire extends Block {
if (random.nextInt(l) < i1) { if (random.nextInt(l) < i1) {
boolean flag = world.getTypeId(i, j, k) == Block.TNT.id; boolean flag = world.getTypeId(i, j, k) == Block.TNT.id;
// CraftBukkit start // CraftBukkit start
Server server = ((WorldServer)world).getServer(); Server server = ((WorldServer) world).getServer();
CraftWorld cworld = ((WorldServer)world).getWorld(); CraftWorld cworld = ((WorldServer) world).getWorld();
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k)); org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k);
BlockBurnEvent event = new BlockBurnEvent(theBlock); BlockBurnEvent event = new BlockBurnEvent(theBlock);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -28,9 +28,8 @@ public class BlockFlowing extends BlockFluids {
} }
public void a(World world, int i, int j, int k, Random random) { 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); CraftBlock source = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
// CraftBukkit end
int l = this.g(world, i, j, k); int l = this.g(world, i, j, k);
byte b0 = 1; byte b0 = 1;
@ -96,8 +95,7 @@ public class BlockFlowing extends BlockFluids {
} }
if (this.l(world, i, j - 1, k)) { if (this.l(world, i, j - 1, k)) {
// CraftBukkit start // CraftBukkit start - send "down" to the server
// Craftbucket send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN); BlockFromToEvent event = new BlockFromToEvent(Type.BLOCK_FLOW, source, BlockFace.DOWN);
((WorldServer) world).getServer().getPluginManager().callEvent(event); ((WorldServer) world).getServer().getPluginManager().callEvent(event);

Datei anzeigen

@ -113,14 +113,14 @@ public class BlockPressurePlate extends Block {
flag1 = true; flag1 = true;
} }
// Craftbukkit start // CraftBukkit start
CraftWorld craftWorld = ((WorldServer) world).getWorld(); CraftWorld craftWorld = ((WorldServer) world).getWorld();
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k); CraftBlock block = (CraftBlock) craftWorld.getBlockAt(i, j, k);
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0); BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
server.getPluginManager().callEvent(eventRedstone); server.getPluginManager().callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0; flag1 = eventRedstone.getNewCurrent() > 0;
// Craftbukkit end // CraftBukkit end
if (flag1 && !flag) { if (flag1 && !flag) {
world.c(i, j, k, 1); world.c(i, j, k, 1);

Datei anzeigen

@ -98,14 +98,14 @@ public class BlockRedstoneTorch extends BlockTorch {
b.remove(0); b.remove(0);
} }
// Craftbukkit start // CraftBukkit start
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent event = new BlockRedstoneEvent(block, flag ? 15 : 0, flag ? 0 : 15); BlockRedstoneEvent event = new BlockRedstoneEvent(block, flag ? 15 : 0, flag ? 0 : 15);
((WorldServer) world).getServer().getPluginManager().callEvent(event); ((WorldServer) world).getServer().getPluginManager().callEvent(event);
if ((event.getNewCurrent() != 0) == flag) { if ((event.getNewCurrent() != 0) == flag) {
return; return;
} }
// Craftbukkit end // CraftBukkit end
if (this.a) { if (this.a) {
if (flag) { if (flag) {
@ -133,7 +133,8 @@ public class BlockRedstoneTorch extends BlockTorch {
} }
public boolean c(World world, int i, int j, int k, int l) { 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) { public int a(int i, Random random) {

Datei anzeigen

@ -103,14 +103,14 @@ public class BlockRedstoneWire extends Block {
} }
} }
// Craftbukkit start // CraftBukkit start
if (k1 != l1) { if (k1 != l1) {
CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k); CraftBlock block = (CraftBlock) ((WorldServer) world).getWorld().getBlockAt(i, j, k);
BlockRedstoneEvent event = new BlockRedstoneEvent(block, k1, l1); BlockRedstoneEvent event = new BlockRedstoneEvent(block, k1, l1);
((WorldServer) world).getServer().getPluginManager().callEvent(event); ((WorldServer) world).getServer().getPluginManager().callEvent(event);
l1 = event.getNewCurrent(); l1 = event.getNewCurrent();
} }
// Craftbukkit end // CraftBukkit end
if (k1 != l1) { if (k1 != l1) {
world.h = true; 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) { 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) { public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {

Datei anzeigen

@ -42,8 +42,8 @@ public class BlockStationary extends BlockFluids {
int l = random.nextInt(3); int l = random.nextInt(3);
// CraftBukkit start: prevent lava putting something on fire. // CraftBukkit start: prevent lava putting something on fire.
Server server = ((WorldServer)world).getServer(); Server server = ((WorldServer) world).getServer();
CraftWorld cworld = ((WorldServer)world).getWorld(); CraftWorld cworld = ((WorldServer) world).getWorld();
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA; IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
Player thePlayer = null; Player thePlayer = null;
@ -60,7 +60,7 @@ public class BlockStationary extends BlockFluids {
// CraftBukkit start: prevent lava putting something on fire. // CraftBukkit start: prevent lava putting something on fire.
org.bukkit.block.Block theBlock = cworld.getBlockAt(i, j, k); 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); BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {

Datei anzeigen

@ -6,6 +6,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
// CraftBukkit
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
public class Chunk { public class Chunk {
@ -47,7 +48,7 @@ public class Chunk {
// CraftBukkit start // CraftBukkit start
CraftWorld cw = ((WorldServer) world).getWorld(); CraftWorld cw = ((WorldServer) world).getWorld();
bukkitChunk = (cw == null) ? null:cw.popPreservedChunk( i, j ); bukkitChunk = (cw == null) ? null : cw.popPreservedChunk( i, j );
if (bukkitChunk == null) { if (bukkitChunk == null) {
bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this ); bukkitChunk = new org.bukkit.craftbukkit.CraftChunk( this );
} }
@ -358,7 +359,8 @@ public class Chunk {
if (i != this.j || j != this.k) { if (i != this.j || j != this.k) {
System.out.println("Wrong location! " + entity); 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(); Thread.dumpStack();
} }

Datei anzeigen

@ -23,8 +23,8 @@ public class ChunkProviderServer implements IChunkProvider {
private IChunkProvider c; private IChunkProvider c;
private IChunkLoader d; private IChunkLoader d;
public LongHashtable<Chunk> e = new LongHashtable<Chunk>(); // CraftBukkit public LongHashtable<Chunk> e = new LongHashtable<Chunk>(); // CraftBukkit
public List f = new ArrayList(); // Craftbukkit public List f = new ArrayList(); // CraftBukkit
public WorldServer g; // Craftbukkit public WorldServer g; // CraftBukkit
public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) {
this.b = new EmptyChunk(worldserver, new byte['\u8000'], 0, 0); 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) { 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) { 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; 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) { if (this.d == null) {
return null; return null;
} else { } 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) { if (this.d != null) {
try { try {
this.d.b(this.g, chunk); 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) { if (this.d != null) {
try { try {
chunk.r = this.g.k(); chunk.r = this.g.k();
@ -201,9 +201,9 @@ public class ChunkProviderServer implements IChunkProvider {
Chunk chunk = e.get(chunkcoordinates); Chunk chunk = e.get(chunkcoordinates);
if (chunk == null) continue; if (chunk == null) continue;
ChunkUnloadEvent cue = new ChunkUnloadEvent(Type.CHUNK_UNLOADED, chunk.bukkitChunk); ChunkUnloadEvent event = new ChunkUnloadEvent(Type.CHUNK_UNLOADED, chunk.bukkitChunk);
server.getPluginManager().callEvent(cue); server.getPluginManager().callEvent(event);
if (!cue.isCancelled()) { if (!event.isCancelled()) {
g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk ); g.getWorld().preserveChunk( (CraftChunk) chunk.bukkitChunk );
chunk.e(); chunk.e();

Datei anzeigen

@ -17,7 +17,7 @@ public class ConsoleCommandHandler {
String s = servercommand.a; String s = servercommand.a;
ICommandListener icommandlistener = servercommand.b; ICommandListener icommandlistener = servercommand.b;
String s1 = icommandlistener.c(); String s1 = icommandlistener.c();
WorldServer worldserver = b.worlds.get(0); // Craftbukkit WorldServer worldserver = this.b.worlds.get(0); // CraftBukkit
ServerConfigurationManager serverconfigurationmanager = this.b.f; ServerConfigurationManager serverconfigurationmanager = this.b.f;
if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) { if (!s.toLowerCase().startsWith("help") && !s.toLowerCase().startsWith("?")) {

Datei anzeigen

@ -2,14 +2,15 @@ package net.minecraft.server;
import java.util.logging.ConsoleHandler; import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler; import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.logging.Handler; // CraftBukkit
public class ConsoleLogManager { public class ConsoleLogManager {
public static Logger a = Logger.getLogger("Minecraft"); public static Logger a = Logger.getLogger("Minecraft");
public static Logger global = Logger.getLogger(""); // Craftbukkit public static Logger global = Logger.getLogger(""); // CraftBukkit
public ConsoleLogManager() {} public ConsoleLogManager() {}
@ -19,22 +20,22 @@ public class ConsoleLogManager {
a.setUseParentHandlers(false); a.setUseParentHandlers(false);
ConsoleHandler consolehandler = new ConsoleHandler(); ConsoleHandler consolehandler = new ConsoleHandler();
// Craftbukkit start // CraftBukkit start
for (Handler handler : global.getHandlers()) { for (Handler handler: global.getHandlers()) {
global.removeHandler(handler); global.removeHandler(handler);
} }
// Craftbukkit end // CraftBukkit end
consolehandler.setFormatter(consolelogformatter); consolehandler.setFormatter(consolelogformatter);
a.addHandler(consolehandler); a.addHandler(consolehandler);
global.addHandler(consolehandler); // Craftbukkit global.addHandler(consolehandler); // CraftBukkit
try { try {
FileHandler filehandler = new FileHandler("server.log", true); FileHandler filehandler = new FileHandler("server.log", true);
filehandler.setFormatter(consolelogformatter); filehandler.setFormatter(consolelogformatter);
a.addHandler(filehandler); a.addHandler(filehandler);
global.addHandler(filehandler); // Craftbukkit global.addHandler(filehandler); // CraftBukkit
} catch (Exception exception) { } catch (Exception exception) {
a.log(Level.WARNING, "Failed to log to server.log", exception); a.log(Level.WARNING, "Failed to log to server.log", exception);
} }

Datei anzeigen

@ -68,7 +68,7 @@ public abstract class Entity {
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; public int fireTicks;
public int maxAirTicks; // Craftbukkit: Make public public int maxAirTicks; // CraftBukkit -- protected->public
protected boolean bv; protected boolean bv;
public int noDamageTicks; public int noDamageTicks;
public int airTicks; public int airTicks;
@ -224,7 +224,7 @@ public abstract class Entity {
if (this.fireTicks % 20 == 0) { if (this.fireTicks % 20 == 0) {
// CraftBukkit start // CraftBukkit start
// TODO: this event spams! // TODO: this event spams!
if(this instanceof EntityLiving) { if (this instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity(); org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.FIRE_TICK; DamageCause damageType = EntityDamageEvent.DamageCause.FIRE_TICK;
@ -233,7 +233,7 @@ public abstract class Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone); EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage()); this.a((Entity) null, event.getDamage());
} }
} else { } else {
@ -264,28 +264,28 @@ public abstract class Entity {
protected void P() { protected void P() {
if (!this.by) { if (!this.by) {
// CraftBukkit start // CraftBukkit start -- TODO: this event spams!
// TODO: this event spams! if (this instanceof EntityLiving) {
if(this instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
// TODO: shouldn't be sending null for the block. // 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(); org.bukkit.entity.Entity damagee = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.LAVA; DamageCause damageType = EntityDamageEvent.DamageCause.LAVA;
int damageDone = 4; int damageDone = 4;
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){
if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage()); this.a((Entity) null, event.getDamage());
} }
if(this.fireTicks <= 0){ if (this.fireTicks <= 0) {
// not on fire yet // not on fire yet
Type eventType = Type.ENTITY_COMBUST; Type eventType = Type.ENTITY_COMBUST;
EntityCombustEvent combustEvent = new EntityCombustEvent(eventType, damagee); EntityCombustEvent combustEvent = new EntityCombustEvent(eventType, damagee);
server.getPluginManager().callEvent(combustEvent); server.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()){ if (!combustEvent.isCancelled()) {
this.fireTicks = 600; this.fireTicks = 600;
} }
} else { } else {
@ -476,10 +476,10 @@ public abstract class Entity {
int i1; int i1;
int j1; int j1;
// Craftbukkit start // CraftBukkit start
if ((this.bg) && (getBukkitEntity() instanceof Vehicle)) { if ((this.bg) && (getBukkitEntity() instanceof Vehicle)) {
Vehicle vehicle = (Vehicle)getBukkitEntity(); Vehicle vehicle = (Vehicle) getBukkitEntity();
org.bukkit.World wrld = ((WorldServer)world).getWorld(); 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)); org.bukkit.block.Block block = wrld.getBlockAt(MathHelper.b(locX), MathHelper.b(locY - 0.20000000298023224D - (double) this.height), MathHelper.b(locZ));
if (d5 > d0) { if (d5 > d0) {
@ -495,7 +495,7 @@ public abstract class Entity {
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block); VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(Type.VEHICLE_COLLISION_BLOCK, vehicle, block);
((WorldServer) world).getServer().getPluginManager().callEvent(event); ((WorldServer) world).getServer().getPluginManager().callEvent(event);
} }
// Craftbukkit end // CraftBukkit end
if (this.bg && !flag) { if (this.bg && !flag) {
this.bf = (float) ((double) this.bf + (double) MathHelper.a(d9 * d9 + d10 * d10) * 0.6D); 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) { if (!flag2) {
++this.fireTicks; ++this.fireTicks;
// CraftBukkit start // CraftBukkit start
if (this.fireTicks <= 0){ if (this.fireTicks <= 0) {
// not on fire yet // not on fire yet
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity damagee = this.getBukkitEntity(); org.bukkit.entity.Entity damagee = this.getBukkitEntity();
@ -556,7 +556,7 @@ public abstract class Entity {
EntityCombustEvent event = new EntityCombustEvent(eventType, damagee); EntityCombustEvent event = new EntityCombustEvent(eventType, damagee);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
this.fireTicks = 300; this.fireTicks = 300;
} }
} else { } else {
@ -602,10 +602,11 @@ public abstract class Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone); EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (event.isCancelled()) {
this.a((Entity) null, event.getDamage()); return;
} }
return;
i = event.getDamage();
} }
// CraftBukkit end // CraftBukkit end
this.a((Entity) null, i); this.a((Entity) null, i);
@ -843,18 +844,18 @@ public abstract class Entity {
this.airTicks = nbttagcompound.d("Air"); this.airTicks = nbttagcompound.d("Air");
this.onGround = nbttagcompound.m("OnGround"); this.onGround = nbttagcompound.m("OnGround");
// Craftbukkit start // CraftBukkit start
if (nbttagcompound.b("World")) { if (nbttagcompound.b("World")) {
String worldName = nbttagcompound.i("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)) { if (world.q.j.equals(worldName)) {
this.world = world; this.world = world;
break; break;
} }
} }
} }
// Craftbukkit end // CraftBukkit end
this.a(this.locX, this.locY, this.locZ); this.a(this.locX, this.locY, this.locZ);
this.b(nbttagcompound); this.b(nbttagcompound);
@ -1005,7 +1006,7 @@ public abstract class Entity {
protected org.bukkit.entity.Entity bukkitEntity; protected org.bukkit.entity.Entity bukkitEntity;
public org.bukkit.entity.Entity getBukkitEntity(){ public org.bukkit.entity.Entity getBukkitEntity() {
if (bukkitEntity == null) { if (bukkitEntity == null) {
bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(((WorldServer) this.world).getServer(), this); bukkitEntity = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(((WorldServer) this.world).getServer(), this);
} }
@ -1021,14 +1022,15 @@ public abstract class Entity {
this.e = 0.0D; this.e = 0.0D;
if (entity == null) { if (entity == null) {
if (this.vehicle != null) { if (this.vehicle != null) {
// Craftbukkit start // CraftBukkit start
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) { if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
CraftVehicle cvehicle = (CraftVehicle)vehicle.getBukkitEntity(); CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
LivingEntity living = (LivingEntity)getBukkitEntity(); LivingEntity living = (LivingEntity) getBukkitEntity();
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living); 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.c(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch);
this.vehicle.passenger = null; this.vehicle.passenger = null;
@ -1036,14 +1038,15 @@ public abstract class Entity {
this.vehicle = null; this.vehicle = null;
} else if (this.vehicle == entity) { } else if (this.vehicle == entity) {
// Craftbukkit start // CraftBukkit start
if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) { if ((this.getBukkitEntity() instanceof LivingEntity) && (vehicle.getBukkitEntity() instanceof CraftVehicle)) {
CraftVehicle cvehicle = (CraftVehicle)vehicle.getBukkitEntity(); CraftVehicle cvehicle = (CraftVehicle) vehicle.getBukkitEntity();
LivingEntity living = (LivingEntity)getBukkitEntity(); LivingEntity living = (LivingEntity) getBukkitEntity();
VehicleExitEvent event = new VehicleExitEvent(Type.VEHICLE_EXIT, cvehicle, living); 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.passenger = null;
this.vehicle = null; this.vehicle = null;

Datei anzeigen

@ -156,7 +156,7 @@ public class EntityArrow extends Entity {
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.world).getServer(); 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 // or leave as DamageCause.ENTITY_ATTACK
org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity(); org.bukkit.entity.Entity shooter = (this.b == null) ? null : this.b.getBukkitEntity();
org.bukkit.entity.Entity damagee = movingobjectposition.g.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); EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if (!event.isCancelled()) {
// this function returns if the arrow should stick in or not, i.e. !bounce // this function returns if the arrow should stick in or not, i.e. !bounce
stick = movingobjectposition.g.a(this.b, event.getDamage()); stick = movingobjectposition.g.a(this.b, event.getDamage());
} else { } else {

Datei anzeigen

@ -220,7 +220,8 @@ public class EntityBoat extends Entity {
this.motZ += this.passenger.motZ * 0.2D; this.motZ += this.passenger.motZ * 0.2D;
} }
d4 = this.maxSpeed; // CraftBukkit // CraftBukkit
d4 = this.maxSpeed;
if (this.motX < -d4) { if (this.motX < -d4) {
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 from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch); Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Vehicle vehicle = (Vehicle) this.getBukkitEntity();
server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle)); server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle));
if (!from.equals(to)) { if (!from.equals(to)) {
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to); VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);

Datei anzeigen

@ -10,8 +10,8 @@ import org.bukkit.event.entity.EntityTargetEvent.TargetReason;
public class EntityCreature extends EntityLiving { public class EntityCreature extends EntityLiving {
public PathEntity a; // Craftbukkit - public public PathEntity a; // CraftBukkit - public
public Entity d; // Craftbukkit - public public Entity d; // CraftBukkit - public
protected boolean e = false; protected boolean e = false;
public EntityCreature(World world) { public EntityCreature(World world) {
@ -29,6 +29,7 @@ public class EntityCreature extends EntityLiving {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), TargetReason.CLOSEST_PLAYER);
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (event.getTarget() == null) { if (event.getTarget() == null) {
this.d = null; this.d = null;
@ -46,6 +47,7 @@ public class EntityCreature extends EntityLiving {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.TARGET_DIED);
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (event.getTarget() == null) { if (event.getTarget() == null) {
this.d = null; this.d = null;
@ -115,7 +117,8 @@ public class EntityCreature extends EntityLiving {
double d1 = vec3d.a - this.locX; double d1 = vec3d.a - this.locX;
double d2 = vec3d.c - this.locZ; double d2 = vec3d.c - this.locZ;
double d3 = vec3d.b - (double) l1; 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; float f5 = f4 - this.yaw;
for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) { for (this.av = this.az; f5 < -180.0F; f5 += 360.0F) {

Datei anzeigen

@ -1,6 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
//CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent; import org.bukkit.event.entity.ExplosionPrimedEvent;
@ -83,18 +83,20 @@ public class EntityCreeper extends EntityMonster {
this.e(1); this.e(1);
++this.a; ++this.a;
if (this.a >= 30) { if (this.a >= 30) {
// Craftbukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; 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); 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.world.a(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.C(); this.C();
} else { } else {
this.a = 0; this.a = 0;
} }
// Craftbukkit end // CraftBukkit end
} }
this.e = true; this.e = true;

Datei anzeigen

@ -167,7 +167,7 @@ public class EntityEgg extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage); EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if (!event.isCancelled()) {
// this function returns if the egg should stick or not, i.e. !bounce // this function returns if the egg should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.g, event.getDamage()); stick = movingobjectposition.g.a(this.g, event.getDamage());
} else { } else {
@ -184,7 +184,7 @@ public class EntityEgg extends Entity {
} }
boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0; 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) { if (!hatching) {
numHatching = 0; numHatching = 0;
} }
@ -195,8 +195,9 @@ public class EntityEgg extends Entity {
Type eventType = Type.PLAYER_EGG_THROW; Type eventType = Type.PLAYER_EGG_THROW;
Player player = (this.g == null) ? null : (Player) this.g.getBukkitEntity(); 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); server.getPluginManager().callEvent(event);
hatching = event.isHatching(); hatching = event.isHatching();
numHatching = event.getNumHatches(); numHatching = event.getNumHatches();
hatchingType = event.getHatchType(); hatchingType = event.getHatchType();

Datei anzeigen

@ -133,7 +133,7 @@ public class EntityFireball extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage); EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if (!event.isCancelled()) {
// this function returns if the fireball should stick or not, i.e. !bounce // this function returns if the fireball should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.j, event.getDamage()); stick = movingobjectposition.g.a(this.j, event.getDamage());
} else { } else {
@ -144,20 +144,20 @@ public class EntityFireball extends Entity {
stick = movingobjectposition.g.a(this.j, 0); stick = movingobjectposition.g.a(this.j, 0);
} }
if (stick) { if (stick) {
// CraftBukkit end
; ;
} }
} }
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; 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); 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.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
this.C(); this.C();
} }
// Craftbukkit end // CraftBukkit end
} }
this.locX += this.motX; this.locX += this.motX;

Datei anzeigen

@ -202,7 +202,7 @@ public class EntityFish extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage); EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if (!event.isCancelled()) {
// this function returns if the fish should stick or not, i.e. !bounce // this function returns if the fish should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.b, event.getDamage()); stick = movingobjectposition.g.a(this.b, event.getDamage());
} else { } else {
@ -213,9 +213,9 @@ public class EntityFish extends Entity {
stick = movingobjectposition.g.a(this.b, 0); stick = movingobjectposition.g.a(this.b, 0);
} }
if (!stick) { if (!stick) {
// CraftBukkit end
this.c = movingobjectposition.g; this.c = movingobjectposition.g;
} }
// CraftBukkit end
} else { } else {
this.h = true; this.h = true;
} }

Datei anzeigen

@ -159,7 +159,8 @@ public abstract class EntityHuman extends EntityLiving {
this.n = this.o; this.n = this.o;
super.q(); super.q();
float f = MathHelper.a(this.motX * this.motX + this.motZ * this.motZ); 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) { if (f > 0.1F) {
f = 0.1F; f = 0.1F;
@ -255,9 +256,10 @@ public abstract class EntityHuman extends EntityLiving {
} }
// CraftBukkit start // CraftBukkit start
Player player = (Player)this.getBukkitEntity(); Player player = (Player) this.getBukkitEntity();
CraftServer server = ((WorldServer)world).getServer(); CraftServer server = ((WorldServer) world).getServer();
CraftItem drop = new CraftItem(server, entityitem); CraftItem drop = new CraftItem(server, entityitem);
PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop); PlayerDropItemEvent event = new PlayerDropItemEvent(player, drop);
server.getPluginManager().callEvent(event); 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 damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK; 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); server.getPluginManager().callEvent(event);
if (event.isCancelled()){ if (event.isCancelled()) {
return; return;
} }
entity.a(this, event.getDamage()); i = event.getDamage();
} else {
entity.a(this, i);
} }
// CraftBukkit end // CraftBukkit end
entity.a(this, i);
ItemStack itemstack = this.z(); ItemStack itemstack = this.z();
if (itemstack != null && entity instanceof EntityLiving) { if (itemstack != null && entity instanceof EntityLiving) {

Datei anzeigen

@ -198,7 +198,7 @@ public class EntityItem extends Entity {
if (this.c == 0) { if (this.c == 0) {
Player player = (Player) entityhuman.getBukkitEntity(); Player player = (Player) entityhuman.getBukkitEntity();
PlayerPickupItemEvent event = new PlayerPickupItemEvent(player, (Item) this.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)) { 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); this.world.a(this, "random.pop", 0.2F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.0F) * 2.0F);

Datei anzeigen

@ -124,10 +124,11 @@ public abstract class EntityLiving extends Entity {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity victim = this.getBukkitEntity(); org.bukkit.entity.Entity victim = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.SUFFOCATION; DamageCause damageType = EntityDamageEvent.DamageCause.SUFFOCATION;
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, 1); EntityDamageEvent event = new EntityDamageEvent(victim, damageType, 1);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
this.a((Entity) null, 1); this.a((Entity) null, 1);
} }
// CraftBukkit end // CraftBukkit end
@ -161,7 +162,7 @@ public abstract class EntityLiving extends Entity {
EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone); EntityDamageEvent event = new EntityDamageEvent(damagee, damageType, damageDone);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage()); this.a((Entity) null, event.getDamage());
} }
// CraftBukkit end // CraftBukkit end
@ -239,7 +240,8 @@ public abstract class EntityLiving extends Entity {
if (f > 0.05F) { if (f > 0.05F) {
f3 = 1.0F; f3 = 1.0F;
f2 = f * 3.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) { if (this.V > 0.0F) {
@ -446,25 +448,26 @@ public abstract class EntityLiving extends Entity {
} }
protected void o() { 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>(); List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
int drop = this.h();
int count = random.nextInt(3); int count = random.nextInt(3);
if ((drop > 0) && (count > 0)) { if ((i > 0) && (count > 0)) {
loot.add(new org.bukkit.inventory.ItemStack(drop, count)); 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); EntityDeathEvent event = new EntityDeathEvent(Type.ENTITY_DEATH, entity, loot);
CraftWorld cworld = ((WorldServer)world).getWorld(); CraftWorld cworld = ((WorldServer) world).getWorld();
Server server = ((WorldServer)world).getServer(); Server server = ((WorldServer) world).getServer();
server.getPluginManager().callEvent(event); 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); cworld.dropItemNaturally(entity.getLocation(), stack);
} }
// Craftbukkit end // CraftBukkit end
} }
protected int h() { protected int h() {
@ -479,10 +482,11 @@ public abstract class EntityLiving extends Entity {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity victim = this.getBukkitEntity(); org.bukkit.entity.Entity victim = this.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.FALL; DamageCause damageType = EntityDamageEvent.DamageCause.FALL;
EntityDamageEvent event = new EntityDamageEvent(victim, damageType, i); EntityDamageEvent event = new EntityDamageEvent(victim, damageType, i);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
this.a((Entity) null, event.getDamage()); this.a((Entity) null, event.getDamage());
} }
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -47,7 +47,7 @@ public class EntityMinecart extends Entity implements IInventory {
public EntityMinecart(World world) { public EntityMinecart(World world) {
super(world); super(world);
this.h = new ItemStack[27]; //Craftbukkit this.h = new ItemStack[27]; // CraftBukkit
this.a = 0; this.a = 0;
this.b = 0; this.b = 0;
this.c = 1; this.c = 1;
@ -106,11 +106,12 @@ public class EntityMinecart extends Entity implements IInventory {
int damage = i; int damage = i;
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, passenger, damage); 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()) { if (event.isCancelled()) {
return true; return true;
} }
i = event.getDamage(); i = event.getDamage();
// CraftBukkit end // CraftBukkit end
@ -225,7 +226,8 @@ public class EntityMinecart extends Entity implements IInventory {
--j; --j;
} }
double d4 = this.maxSpeed; // CraftBukkit // CraftBukkit
double d4 = this.maxSpeed;
boolean flag = false; boolean flag = false;
d0 = 0.0078125D; d0 = 0.0078125D;
@ -254,7 +256,8 @@ public class EntityMinecart extends Entity implements IInventory {
this.motZ -= d0; 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 d5 = (double) (aint[1][0] - aint[0][0]);
double d6 = (double) (aint[1][2] - aint[0][2]); double d6 = (double) (aint[1][2] - aint[0][2]);
double d7 = Math.sqrt(d5 * d5 + d6 * d6); 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); 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.motX *= 0.996999979019165D;
this.motY *= 0.0D; this.motY *= 0.0D;
this.motZ *= 0.996999979019165D; 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 from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch); Location to = new Location(world, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
Vehicle vehicle = (Vehicle) this.getBukkitEntity(); Vehicle vehicle = (Vehicle) this.getBukkitEntity();
server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle)); server.getPluginManager().callEvent(new VehicleEvent(Type.VEHICLE_UPDATE, vehicle));
if (!from.equals(to)) { if (!from.equals(to)) {
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to); VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, vehicle, from, to);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
@ -606,7 +612,6 @@ public class EntityMinecart extends Entity implements IInventory {
public void h(Entity entity) { public void h(Entity entity) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
if (entity != this.passenger) { if (entity != this.passenger) {
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) world).getServer(); CraftServer server = ((WorldServer) world).getServer();
Type eventType = Type.VEHICLE_COLLISION_ENTITY; Type eventType = Type.VEHICLE_COLLISION_ENTITY;

Datei anzeigen

@ -48,13 +48,15 @@ public class EntityMonster extends EntityCreature implements IMonster {
if (this.passenger != entity && this.vehicle != entity) { if (this.passenger != entity && this.vehicle != entity) {
if (entity != this) { if (entity != this) {
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity bukkitTarget = null; org.bukkit.entity.Entity bukkitTarget = null;
if (entity != null) { if (entity != null) {
bukkitTarget = entity.getBukkitEntity(); bukkitTarget = entity.getBukkitEntity();
} }
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.TARGET_ATTACKED_ENTITY);
CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (event.getTarget() == null) { if (event.getTarget() == null) {
this.d = 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 damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK; 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); server.getPluginManager().callEvent(event);
if (!event.isCancelled()){ if (!event.isCancelled()) {
entity.a(this, event.getDamage()); entity.a(this, event.getDamage());
} }
} else { return;
entity.a(this, this.c);
} }
// CraftBukkit end // CraftBukkit end
entity.a(this, this.c);
} }
} }

Datei anzeigen

@ -76,13 +76,15 @@ public class EntityPigZombie extends EntityZombie {
private void c(Entity entity) { private void c(Entity entity) {
// CraftBukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.entity.Entity bukkitTarget = null; org.bukkit.entity.Entity bukkitTarget = null;
if (entity != null) { if (entity != null) {
bukkitTarget = entity.getBukkitEntity(); bukkitTarget = entity.getBukkitEntity();
} }
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), bukkitTarget, TargetReason.PIG_ZOMBIE_TARGET);
CraftServer server = ((WorldServer) this.world).getServer();
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (event.getTarget() == null) { if (event.getTarget() == null) {
this.d = null; this.d = null;

Datei anzeigen

@ -1,17 +1,19 @@
package net.minecraft.server; package net.minecraft.server;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
// CraftBukkit start
import java.util.ArrayList;
import org.bukkit.Server; import org.bukkit.Server;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityDeathEvent;
// CraftBukkit end
public class EntityPlayer extends EntityHuman implements ICrafting { public class EntityPlayer extends EntityHuman implements ICrafting {
@ -86,7 +88,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void a(Entity entity) { public void a(Entity entity) {
// Craftbukkit start // CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
for (int i = 0; i < inventory.a.length; ++i) { for (int i = 0; i < inventory.a.length; ++i) {
@ -101,16 +103,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
} }
CraftEntity ent = (CraftEntity)getBukkitEntity(); CraftEntity craftEntity = (CraftEntity) getBukkitEntity();
EntityDeathEvent event = new EntityDeathEvent(Event.Type.ENTITY_DEATH, ent, loot); CraftWorld cworld = ((WorldServer) world).getWorld();
CraftWorld cworld = ((WorldServer)world).getWorld(); Server server = ((WorldServer) world).getServer();
Server server = ((WorldServer)world).getServer();
EntityDeathEvent event = new EntityDeathEvent(Event.Type.ENTITY_DEATH, craftEntity, loot);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { for (org.bukkit.inventory.ItemStack stack: event.getDrops()) {
cworld.dropItemNaturally(ent.getLocation(), stack); cworld.dropItemNaturally(craftEntity.getLocation(), stack);
} }
// Craftbukkit end // CraftBukkit end
} }
public boolean a(Entity entity, int i) { public boolean a(Entity entity, int i) {

Datei anzeigen

@ -42,8 +42,10 @@ public class EntitySkeleton extends EntityMonster {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
Type eventType = Type.ENTITY_COMBUST; Type eventType = Type.ENTITY_COMBUST;
org.bukkit.entity.Entity entity = this.getBukkitEntity(); org.bukkit.entity.Entity entity = this.getBukkitEntity();
EntityCombustEvent event = new EntityCombustEvent(eventType, entity); EntityCombustEvent event = new EntityCombustEvent(eventType, entity);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.fireTicks = 300; this.fireTicks = 300;
} }
@ -90,7 +92,7 @@ public class EntitySkeleton extends EntityMonster {
} }
protected void o() { protected void o() {
// Craftbukkit start - whole method // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new ArrayList<org.bukkit.inventory.ItemStack>();
int count = this.random.nextInt(3); 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)); 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); EntityDeathEvent event = new EntityDeathEvent(Type.ENTITY_DEATH, entity, loot);
CraftWorld cworld = ((WorldServer)world).getWorld();
Server server = ((WorldServer)world).getServer();
server.getPluginManager().callEvent(event); 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); cworld.dropItemNaturally(entity.getLocation(), stack);
} }
// Craftbukkit end // CraftBukkit end
} }
} }

Datei anzeigen

@ -162,7 +162,7 @@ public class EntitySnowball extends Entity {
EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage); EntityDamageByProjectileEvent event = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if(!event.isCancelled()) { if (!event.isCancelled()) {
// this function returns if the snowball should stick or not, i.e. !bounce // this function returns if the snowball should stick or not, i.e. !bounce
stick = movingobjectposition.g.a(this.g, event.getDamage()); stick = movingobjectposition.g.a(this.g, event.getDamage());
} else { } else {

Datei anzeigen

@ -49,9 +49,10 @@ public class EntitySpider extends EntityMonster {
if (f1 > 0.5F && this.random.nextInt(100) == 0) { if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start // CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, TargetReason.FORGOT_TARGET);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (event.getTarget() == null) { if (event.getTarget() == null) {
this.d = null; this.d = null;

Datei anzeigen

@ -1,6 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
//CraftBukkit start // CraftBukkit start
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.ExplosionPrimedEvent; import org.bukkit.event.entity.ExplosionPrimedEvent;
@ -55,11 +55,10 @@ public class EntityTNTPrimed extends Entity {
} }
if (this.a-- <= 0) { if (this.a-- <= 0) {
// Craftbukkit start // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event.
// Need to reverse the order of the explosion and the entity death so we have a location for the event.
this.h(); this.h();
this.C(); this.C();
// Craftbukkit end // CraftBukkit end
} else { } else {
this.world.a("smoke", this.locX, this.locY + 0.5D, this.locZ, 0.0D, 0.0D, 0.0D); 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() { private void h() {
float f = 4.0F; float f = 4.0F;
// Craftbukkit start // CraftBukkit start
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED; org.bukkit.event.Event.Type eventType = ExplosionPrimedEvent.Type.EXPLOSION_PRIMED;
ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), f, false); ExplosionPrimedEvent event = new ExplosionPrimedEvent(eventType, CraftEntity.getEntity(server, this), f, false);
server.getPluginManager().callEvent(event); 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.world.a((Entity) null, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire());
} }
// Craftbukkit end // CraftBukkit end
} }
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {

Datei anzeigen

@ -73,7 +73,8 @@ public class EntityTracker {
this.a.add(entitytrackerentry); this.a.add(entitytrackerentry);
this.b.a(entity.id, 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()) { while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); 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) { if (entitytrackerentry.m && entitytrackerentry.a instanceof EntityPlayer) {
arraylist.add((EntityPlayer) entitytrackerentry.a); arraylist.add((EntityPlayer) entitytrackerentry.a);
} }

Datei anzeigen

@ -159,7 +159,8 @@ public class EntityTrackerEntry {
double d1 = entityplayer.locZ - (double) (this.f / 32); 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 (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); this.n.add(entityplayer);
entityplayer.a.b(this.b()); entityplayer.a.b(this.b());
if (this.s) { if (this.s) {

Datei anzeigen

@ -24,6 +24,7 @@ public class EntityZombie extends EntityMonster {
CraftServer server = ((WorldServer) this.world).getServer(); CraftServer server = ((WorldServer) this.world).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity()); EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.fireTicks = 300; this.fireTicks = 300;
} }

Datei anzeigen

@ -30,7 +30,7 @@ public class Explosion {
public float f; public float f;
public Set g = new HashSet(); 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) { public Explosion(World world, Entity entity, double d0, double d1, double d2, float f) {
this.i = world; this.i = world;
@ -125,14 +125,16 @@ public class Explosion {
DamageCause damageType; DamageCause damageType;
int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.f + 1.0D); int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.f + 1.0D);
if(damagee == null) { if (damagee == null) {
// nothing was hurt // nothing was hurt
} else if (e == null) { // Block explosion } else if (e == null) { // Block explosion
// TODO: get the x/y/z of the tnt block? // TODO: get the x/y/z of the tnt block?
// does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever // does this even get called ever? @see EntityTNTPrimed - not BlockTNT or whatever
damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION; damageType = EntityDamageEvent.DamageCause.BLOCK_EXPLOSION;
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone); EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, damagee, damageType, damageDone);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
entity.a(this.e, event.getDamage()); entity.a(this.e, event.getDamage());
entity.motX += d0 * d10; entity.motX += d0 * d10;
@ -187,20 +189,20 @@ public class Explosion {
// CraftBukkit start // CraftBukkit start
Server server = ((WorldServer) this.i).getServer(); Server server = ((WorldServer) this.i).getServer();
CraftWorld world = ((WorldServer) this.i).getWorld(); 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); 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--) { for (int j = arraylist.size() - 1; j >= 0; j--) {
ChunkPosition cpos = (ChunkPosition) arraylist.get(j); ChunkPosition cpos = (ChunkPosition) arraylist.get(j);
org.bukkit.block.Block blox = world.getBlockAt(cpos.a, cpos.b, cpos.c); org.bukkit.block.Block block = world.getBlockAt(cpos.a, cpos.b, cpos.c);
if (!blox.getType().equals(org.bukkit.Material.AIR)) { if (!block.getType().equals(org.bukkit.Material.AIR)) {
blocklist.add(blox); blockList.add(block);
} }
} }
org.bukkit.event.Event.Type eventType = EntityExplodeEvent.Type.ENTITY_EXPLODE; 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); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -239,7 +241,8 @@ public class Explosion {
} }
if (i1 > 0) { 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); this.i.e(j, k, l, 0);
Block.byId[i1].c(this.i, j, k, l); Block.byId[i1].c(this.i, j, k, l);
} }

Datei anzeigen

@ -5,7 +5,7 @@ public class InventoryPlayer implements IInventory {
public ItemStack[] a = new ItemStack[36]; public ItemStack[] a = new ItemStack[36];
public ItemStack[] b = new ItemStack[4]; public ItemStack[] b = new ItemStack[4];
public int c = 0; public int c = 0;
public EntityHuman e; // Craftbukkit - public public EntityHuman e; // CraftBukkit - private->public
private ItemStack f; private ItemStack f;
public boolean d = false; public boolean d = false;

Datei anzeigen

@ -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) { public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
// CraftBukkit start // CraftBukkit start -- Bail if we have nothing of the item in hand
// Bail if we have nothing of the item in hand
if (itemstack.count == 0) { if (itemstack.count == 0) {
return false; return false;
} }
@ -101,7 +100,8 @@ public class ItemBlock extends Item {
int distanceFromSpawn = (int) Math.max(Math.abs(i - spawnX), Math.abs(k - spawnZ)); 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); BlockPlaceEvent event = new BlockPlaceEvent(eventType, placedBlock, replacedBlockState, blockClicked, itemInHand, thePlayer, canBuild);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);

Datei anzeigen

@ -103,7 +103,7 @@ public class ItemInWorldManager {
public boolean d(int i, int j, int k) { public boolean d(int i, int j, int k) {
// CraftBukkit start // CraftBukkit start
if (this.a instanceof EntityPlayer){ if (this.a instanceof EntityPlayer) {
CraftServer server = ((WorldServer) this.b).getServer(); CraftServer server = ((WorldServer) this.b).getServer();
org.bukkit.block.Block block = ((WorldServer) this.b).getWorld().getBlockAt(i, j, k); 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(); 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); BlockBreakEvent event = new BlockBreakEvent(block,player);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()){ if (event.isCancelled()) {
return true; return true;
} }
} }

Datei anzeigen

@ -5,7 +5,7 @@ public final class ItemStack {
public int count; public int count;
public int b; public int b;
public int id; public int id;
public int damage; // Craftbukkit - make public public int damage; // CraftBukkit - private->public
public ItemStack(Block block) { public ItemStack(Block block) {
this(block, 1); this(block, 1);

Datei anzeigen

@ -3,7 +3,6 @@ package net.minecraft.server;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@ -14,6 +13,7 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
// CraftBukkit start // CraftBukkit start
import java.io.PrintStream;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import joptsimple.OptionSet; import joptsimple.OptionSet;
import org.bukkit.command.ConsoleCommandSender; import org.bukkit.command.ConsoleCommandSender;
@ -22,7 +22,7 @@ import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.craftbukkit.scheduler.CraftScheduler; import org.bukkit.craftbukkit.scheduler.CraftScheduler;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.world.WorldEvent; import org.bukkit.event.world.WorldEvent;
//CraftBukkit end // CraftBukkit end
public class MinecraftServer implements Runnable, ICommandListener { public class MinecraftServer implements Runnable, ICommandListener {
@ -30,7 +30,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public static HashMap b = new HashMap(); public static HashMap b = new HashMap();
public NetworkListenThread c; public NetworkListenThread c;
public PropertyManager d; public PropertyManager d;
//public WorldServer e; // Craftbukkit - removed // public WorldServer e; // CraftBukkit - removed
public ServerConfigurationManager f; public ServerConfigurationManager f;
private ConsoleCommandHandler o; private ConsoleCommandHandler o;
private boolean p = true; private boolean p = true;
@ -45,7 +45,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public boolean m; public boolean m;
public boolean n; public boolean n;
// Craftbukkit start // CraftBukkit start
public int spawnProtection; public int spawnProtection;
public List<WorldServer> worlds = new ArrayList<WorldServer>(); public List<WorldServer> worlds = new ArrayList<WorldServer>();
public CraftServer server; public CraftServer server;
@ -53,7 +53,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
public ConsoleCommandSender console; public ConsoleCommandSender console;
// Craftbukkit end // Craftbukkit end
public MinecraftServer(OptionSet options) { // Craftbukkit - adds argument OptionSet public MinecraftServer(OptionSet options) { // CraftBukkit - adds argument OptionSet
new ThreadSleepForever(this); new ThreadSleepForever(this);
this.options = options; // CraftBukkit this.options = options; // CraftBukkit
} }
@ -66,10 +66,10 @@ public class MinecraftServer implements Runnable, ICommandListener {
threadcommandreader.start(); threadcommandreader.start();
ConsoleLogManager.a(); ConsoleLogManager.a();
// Craftbukkit start // CraftBukkit start
System.setOut(new PrintStream(new LoggerOutputStream(a, Level.INFO), true)); System.setOut(new PrintStream(new LoggerOutputStream(a, Level.INFO), true));
System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true)); System.setErr(new PrintStream(new LoggerOutputStream(a, Level.SEVERE), true));
// Craftbukkit end // CraftBukkit end
a.info("Starting minecraft server version Beta 1.3"); a.info("Starting minecraft server version Beta 1.3");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
@ -78,7 +78,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
} }
a.info("Loading properties"); a.info("Loading properties");
this.d = new PropertyManager(options); // Craftbukkit this.d = new PropertyManager(options); // CraftBukkit
String s = this.d.a("server-ip", ""); String s = this.d.a("server-ip", "");
this.l = this.d.a("online-mode", true); this.l = this.d.a("online-mode", true);
@ -130,18 +130,18 @@ public class MinecraftServer implements Runnable, ICommandListener {
a.info("Preparing start region"); 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); 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.a(new WorldManager(this, world));
world.j = this.d.a("spawn-monsters", true) ? 1 : 0; world.j = this.d.a("spawn-monsters", true) ? 1 : 0;
world.a(this.d.a("spawn-monsters", true), this.m); world.a(this.d.a("spawn-monsters", true), this.m);
this.f.a(world); this.f.a(world);
worlds.add(world); worlds.add(world);
// Craftbukkit end // CraftBukkit end
short short1 = 196; short short1 = 196;
long i = System.currentTimeMillis(); 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 j = -short1; j <= short1 && this.p; j += 16) {
for (int k = -short1; k <= short1 && this.p; k += 16) { for (int k = -short1; k <= short1 && this.p; k += 16) {
@ -159,15 +159,15 @@ public class MinecraftServer implements Runnable, ICommandListener {
i = l; i = l;
} }
// Craftbukkit start // CraftBukkit start
for (WorldServer worldserver : worlds) { for (WorldServer worldserver: worlds) {
world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4); world.u.d(chunkcoordinates.a + j >> 4, chunkcoordinates.c + k >> 4);
while (world.e() && this.p) { while (world.e() && this.p) {
; ;
} }
} }
// Craftbukkit end // CraftBukkit end
} }
} }
@ -190,30 +190,30 @@ public class MinecraftServer implements Runnable, ICommandListener {
private void f() { private void f() {
a.info("Saving chunks"); a.info("Saving chunks");
// Craftbukkit start // CraftBukkit start
for (WorldServer world : worlds) { for (WorldServer world: worlds) {
world.a(true, (IProgressUpdate) null); world.a(true, (IProgressUpdate) null);
world.r(); world.r();
Event worldSaved = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() ); WorldEvent event = new WorldEvent( Event.Type.WORLD_SAVED, world.getWorld() );
server.getPluginManager().callEvent( worldSaved ); server.getPluginManager().callEvent( event );
} }
// Craftbukkit end // CraftBukkit end
} }
private void g() { private void g() {
a.info("Stopping server"); a.info("Stopping server");
// CraftBukkit start // CraftBukkit start
if(server != null) { if (server != null) {
server.disablePlugins(); server.disablePlugins();
} }
// Craftbukkit end // CraftBukkit end
if (this.f != null) { if (this.f != null) {
this.f.d(); this.f.d();
} }
if (this.worlds.size() > 0) { // Craftbukkit if (this.worlds.size() > 0) { // CraftBukkit
this.f(); this.f();
} }
} }
@ -243,7 +243,8 @@ public class MinecraftServer implements Runnable, ICommandListener {
j += l; j += l;
i = k; 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(); this.h();
j = 0L; j = 0L;
} else { } else {
@ -314,7 +315,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
Vec3D.a(); Vec3D.a();
++this.h; ++this.h;
// Craftbukkit start // CraftBukkit start
if (this.h % 20 == 0) { if (this.h % 20 == 0) {
for (int i = 0; i < this.f.b.size(); ++i) { for (int i = 0; i < this.f.b.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.f.b.get(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); ((CraftScheduler) server.getScheduler()).mainThreadHeartbeat(this.h);
for (WorldServer world : worlds) { for (WorldServer world: worlds) {
world.g(); world.g();
while (world.e()) { while (world.e()) {
@ -333,8 +334,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
world.d(); world.d();
} }
// Craftbukkit end // CraftBukkit end
this.c.a(); this.c.a();
this.f.b(); this.f.b();
this.k.a(); this.k.a();
@ -358,11 +358,11 @@ public class MinecraftServer implements Runnable, ICommandListener {
while (this.r.size() > 0) { while (this.r.size() > 0) {
ServerCommand servercommand = (ServerCommand) this.r.remove(0); ServerCommand servercommand = (ServerCommand) this.r.remove(0);
// Craftbukkit start // CraftBukkit start
if (server.dispatchCommand(console, servercommand.a)) { if (server.dispatchCommand(console, servercommand.a)) {
continue; continue;
} }
// Craftbukkit end // CraftBukkit end
this.o.a(servercommand); this.o.a(servercommand);
} }
@ -372,7 +372,7 @@ public class MinecraftServer implements Runnable, ICommandListener {
this.q.add(iupdateplayerlistbox); 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 { try {
MinecraftServer minecraftserver = new MinecraftServer(options); MinecraftServer minecraftserver = new MinecraftServer(options);

Datei anzeigen

@ -79,7 +79,7 @@ public class NetLoginHandler extends NetHandler {
a.info(this.b() + " logged in with entity id " + entityplayer.id); a.info(this.b() + " logged in with entity id " + entityplayer.id);
NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer); NetServerHandler netserverhandler = new NetServerHandler(this.e, this.b, entityplayer);
// Craftbukkit start // CraftBukkit start
ChunkCoordinates chunkcoordinates = entityplayer.world.l(); ChunkCoordinates chunkcoordinates = entityplayer.world.l();
netserverhandler.b((Packet) (new Packet1Login("", "", entityplayer.id, entityplayer.world.j(), (byte) entityplayer.world.m.g))); 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))); 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); netserverhandler.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.e.c.a(netserverhandler); this.e.c.a(netserverhandler);
netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k()))); netserverhandler.b((Packet) (new Packet4UpdateTime(entityplayer.world.k())));
// Craftbukkit end // CraftBukkit end
entityplayer.l(); entityplayer.l();
} }

Datei anzeigen

@ -3,10 +3,10 @@ package net.minecraft.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
// CraftBukkit start // CraftBukkit start
import java.util.logging.Level;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockDamageLevel; import org.bukkit.block.BlockDamageLevel;
@ -29,7 +29,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public NetworkManager b; public NetworkManager b;
public boolean c = false; public boolean c = false;
private MinecraftServer d; private MinecraftServer d;
public EntityPlayer e; // Craftbukkit - public public EntityPlayer e; // CraftBukkit - private->public
private int f; private int f;
private int g; private int g;
private boolean h; private boolean h;
@ -76,16 +76,16 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(String s) { public void a(String s) {
// CraftBukkit start // CraftBukkit start
String leaveMessage = "\u00A7e" + this.e.name + " left the game."; 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); PlayerKickEvent event = new PlayerKickEvent(org.bukkit.event.Event.Type.PLAYER_KICK, server.getPlayer(this.e), s, leaveMessage);
server.getPluginManager().callEvent(kickEvent); server.getPluginManager().callEvent(event);
if (kickEvent.isCancelled()) { if (event.isCancelled()) {
// Do not kick the player // Do not kick the player
return; return;
} }
// Send the possibly modified leave message // 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.b.c();
this.d.f.a((Packet) (new Packet3Chat( kickEvent.getLeaveMessage() ))); this.d.f.a((Packet) (new Packet3Chat( event.getLeaveMessage() )));
// CraftBukkit end // CraftBukkit end
this.d.f.c(this.e); this.d.f.c(this.e);
this.c = true; this.c = true;
@ -159,7 +159,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.motX = d5; this.e.motX = d5;
this.e.motZ = d4; this.e.motZ = d4;
if (this.e.vehicle != null) { 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) { if (this.e.vehicle != null) {
@ -170,7 +171,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.i = this.e.locX; this.i = this.e.locX;
this.j = this.e.locY; this.j = this.e.locY;
this.k = this.e.locZ; this.k = this.e.locZ;
this.e.world.f(this.e); // Craftbukkit // CraftBukkit
this.e.world.f(this.e);
return; return;
} }
@ -211,7 +213,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
double d6 = d2 - this.e.locY; double d6 = d2 - this.e.locY;
double d7 = d3 - this.e.locZ; double d7 = d3 - this.e.locZ;
float f4 = 0.0625F; 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); this.e.c(d4, d6, d7);
d4 = d1 - this.e.locX; d4 = d1 - this.e.locX;
@ -232,7 +235,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
this.e.b(d1, d2, d3, f2, f3); 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()) { if (flag && (flag1 || !flag2) && !this.e.E()) {
this.a(this.i, this.j, this.k, f2, f3); 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) { if (packet14blockdig.e == 4) {
this.e.y(); this.e.y();
} else { } 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; boolean flag1 = false;
if (packet14blockdig.e == 0) { 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 l = (int) MathHelper.e((float) (i - chunkcoordinates.a));
int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c)); int i1 = (int) MathHelper.e((float) (k - chunkcoordinates.c));
@ -315,7 +321,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int blockId = block.getTypeId(); int blockId = block.getTypeId();
float damage = 0; float damage = 0;
if (Block.byId[blockId] != null) { 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 // CraftBukkit end
@ -343,7 +349,6 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
} }
} }
// CraftBukkit end
} else if (packet14blockdig.e == 2) { } else if (packet14blockdig.e == 2) {
// CraftBukkit start - Get last block that the player hit // CraftBukkit start - Get last block that the player hit
// Otherwise the block is a Bedrock @(0,0,0) // Otherwise the block is a Bedrock @(0,0,0)
@ -360,7 +365,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
BlockDamageEvent event; BlockDamageEvent event;
// If the amount of damage going to the block plus the current amount // 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. // 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 // 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 // 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) // 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); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { 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) { } else if (packet14blockdig.e == 3) {
double d4 = this.e.locX - ((double) i + 0.5D); double d4 = this.e.locX - ((double) i + 0.5D);
double d5 = this.e.locY - ((double) j + 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; double d7 = d4 * d4 + d5 * d5 + d6 * d6;
if (d7 < 256.0D) { if (d7 < 256.0D) {
// CraftBukkit
this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world))); this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
} }
} }
// CraftBukkit start
lastX = i; lastX = i;
lastY = j; lastY = j;
lastZ = k; lastZ = k;
((WorldServer)this.e.world).v = false; ((WorldServer) this.e.world).v = false;
// CraftBukkit end // CraftBukkit end
} }
} }
public void a(Packet15Place packet15place) { public void a(Packet15Place packet15place) {
ItemStack itemstack = this.e.inventory.b(); ItemStack itemstack = this.e.inventory.b();
boolean flag = ((WorldServer)this.e.world).v = this.d.f.h(this.e.name); // Craftbukkit
// CraftBukkit start // CraftBukkit start
boolean flag = ((WorldServer) this.e.world).v = this.d.f.h(this.e.name);
CraftBlock blockClicked = null; CraftBlock blockClicked = null;
BlockFace blockFace = null; BlockFace blockFace = null;
@ -415,7 +423,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
lastMaterial = 0; lastMaterial = 0;
} else { } else {
// CraftBukkit RIGHTCLICK or BLOCK_PLACE .. or nothing // 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; lastRightClicked = blockClicked;
lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.id; lastMaterial = (packet15place.e == null) ? 0 : packet15place.e.id;
} }
@ -471,7 +479,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
int j = packet15place.b; int j = packet15place.b;
int k = packet15place.c; int k = packet15place.c;
int l = packet15place.d; 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 i1 = (int) MathHelper.e((float) (i - chunkcoordinates.a));
int j1 = (int) MathHelper.e((float) (k - chunkcoordinates.c)); 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.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))); this.e.a.b((Packet) (new Packet53BlockChange(i, j, k, this.e.world)));
// CraftBukkit end // CraftBukkit end
if (l == 0) { if (l == 0) {
--j; --j;
} }
@ -513,7 +521,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
++i; ++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) { if (itemstack != null && itemstack.count == 0) {
@ -527,11 +536,13 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.e.activeContainer.a(); this.e.activeContainer.a();
this.e.h = false; 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()))); 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) { public void a(String s, Object[] aobject) {
@ -552,10 +563,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet16BlockItemSwitch packet16blockitemswitch) { public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
// Craftbukkit start // CraftBukkit start
PlayerItemHeldEvent event = new PlayerItemHeldEvent(Type.PLAYER_ITEM_HELD, getPlayer(), e.inventory.c, packet16blockitemswitch.a); PlayerItemHeldEvent event = new PlayerItemHeldEvent(Type.PLAYER_ITEM_HELD, getPlayer(), e.inventory.c, packet16blockitemswitch.a);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
// Craftbukkit end // CraftBukkit end
this.e.inventory.c = packet16blockitemswitch.a; 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) { public boolean chat(String msg) {
if (msg.startsWith("/")) { if (msg.startsWith("/")) {
this.c(msg); this.c(msg);
@ -589,11 +600,12 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
Player player = getPlayer(); Player player = getPlayer();
PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_CHAT, player, msg); PlayerChatEvent event = new PlayerChatEvent(Type.PLAYER_CHAT, player, msg);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
msg = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
if (event.isCancelled()) { if (event.isCancelled()) {
return true; return true;
} }
msg = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage());
a.info(msg); a.info(msg);
for (final String line: TextWrapper.wrapText(msg)) { for (final String line: TextWrapper.wrapText(msg)) {
this.d.f.a((Packet) (new Packet3Chat(line))); this.d.f.a((Packet) (new Packet3Chat(line)));
@ -632,6 +644,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// Legacy command handler // Legacy command handler
event = new PlayerChatEvent(Type.PLAYER_COMMAND, player, s); event = new PlayerChatEvent(Type.PLAYER_COMMAND, player, s);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
@ -724,7 +737,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet7UseEntity packet7useentity) { 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 (entity != null && this.e.e(entity) && this.e.f(entity) < 4.0F) {
if (packet7useentity.c == 0) { if (packet7useentity.c == 0) {
@ -741,7 +755,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start // CraftBukkit start
CraftPlayer player = getPlayer(); CraftPlayer player = getPlayer();
player.setHandle(e); player.setHandle(this.e);
// CraftBukkit end // CraftBukkit end
} }
} }
@ -784,8 +798,10 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
public void a(Packet130UpdateSign packet130updatesign) { public void a(Packet130UpdateSign packet130updatesign) {
if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) { // Craftbukkit // CraftBukkit start
TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c); // Craftbukkit 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 i;
int j; int j;
@ -817,23 +833,25 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start - SIGN_CHANGE hook // CraftBukkit start - SIGN_CHANGE hook
Player player = server.getPlayer(this.e); 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); 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(modifyEvent); server.getPluginManager().callEvent(event);
if (modifyEvent.isCancelled()) {
if (event.isCancelled()) {
// Normally we would return here, but we have to update the sign with blank text if it's been cancelled // 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) // Otherwise the client will have bad text on their sign (client shows text changes as they type)
for(int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
modifyEvent.setLine(l, ""); event.setLine(l, "");
} }
} }
// CraftBukkit end // CraftBukkit end
for (int l = 0; l < 4; ++l) { for (int l = 0; l < 4; ++l) {
tileentitysign.a[l] = modifyEvent.getLine(l); // CraftBukkit tileentitysign.a[l] = event.getLine(l);
// CraftBukkit
} }
tileentitysign.h(); tileentitysign.h();
this.e.world.g(i, k, j); // Craftbukkit this.e.world.g(i, k, j); // CraftBukkit
} }
} }
} }

Datei anzeigen

@ -29,7 +29,8 @@ class PlayerInstance {
this.d = j; this.d = j;
this.e = new ChunkCoordIntPair(i, 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) { public void a(EntityPlayer entityplayer) {
@ -56,7 +57,8 @@ class PlayerInstance {
PlayerManager.c(this.a).remove(this); 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); entityplayer.f.remove(this.e);
@ -132,12 +134,12 @@ class PlayerInstance {
j = this.j; j = this.j;
k = this.d * 16 + this.l; k = this.d * 16 + this.l;
// Craftbukkit start // CraftBukkit start
this.a((Packet) (new Packet53BlockChange(i, j, k, a.world))); this.a((Packet) (new Packet53BlockChange(i, j, k, a.world)));
if (Block.p[a.world.getTypeId(i, j, k)]) { if (Block.p[a.world.getTypeId(i, j, k)]) {
this.a(a.world.getTileEntity(i, j, k)); this.a(a.world.getTileEntity(i, j, k));
} }
// Craftbukkit end // CraftBukkit end
} else { } else {
int l; int l;
@ -151,23 +153,28 @@ class PlayerInstance {
int i1 = this.k - this.j + 2; int i1 = this.k - this.j + 2;
int j1 = this.m - this.l + 1; int j1 = this.m - this.l + 1;
this.a((Packet) (new Packet51MapChunk(i, j, k, l, i1, j1, a.world))); // Craftbukkit // CraftBukkit start
List list = a.world.d(i, j, k, i + l, j + i1, k + j1); // Craftbukkit 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) { for (int k1 = 0; k1 < list.size(); ++k1) {
this.a((TileEntity) list.get(k1)); this.a((TileEntity) list.get(k1));
} }
} else { } 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) { for (i = 0; i < this.g; ++i) {
j = this.c * 16 + (this.g >> 12 & 15); j = this.c * 16 + (this.g >> 12 & 15);
k = this.g & 255; k = this.g & 255;
l = this.d * 16 + (this.g >> 8 & 15); 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!"); System.out.println("Sending!");
this.a(a.world.getTileEntity(j, k, l)); // Craftbukkit this.a(a.world.getTileEntity(j, k, l));
} }
// CraftBukkit end
} }
} }
} }

Datei anzeigen

@ -10,14 +10,16 @@ public class PlayerManager {
private List c = new ArrayList(); private List c = new ArrayList();
private MinecraftServer d; private MinecraftServer d;
private final int[][] e = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}}; 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) { public PlayerManager(MinecraftServer minecraftserver, WorldServer world) {
this.d = minecraftserver; this.d = minecraftserver;
this.world = world;
this.world = world; // Craftbukkit
} }
// CraftBukkit end
public void a() { public void a() {
for (int i = 0; i < this.c.size(); ++i) { for (int i = 0; i < this.c.size(); ++i) {

Datei anzeigen

@ -34,14 +34,14 @@ public class PropertyManager {
private OptionSet options = null; private OptionSet options = null;
public PropertyManager(final OptionSet options) { public PropertyManager(final OptionSet options) {
this((File)options.valueOf("config")); this((File) options.valueOf("config"));
this.options = options; this.options = options;
} }
private <T> T getOverride(String name, T value) { private <T> T getOverride(String name, T value) {
if ((options != null) && (options.has(name))) { if ((options != null) && (options.has(name))) {
return (T)options.valueOf(name); return (T) options.valueOf(name);
} }
return value; return value;

Datei anzeigen

@ -29,9 +29,9 @@ public class ServerConfigurationManager {
public static Logger a = Logger.getLogger("Minecraft"); public static Logger a = Logger.getLogger("Minecraft");
public List b = new ArrayList(); public List b = new ArrayList();
public MinecraftServer c; // Craftbukkit - public public MinecraftServer c; // CraftBukkit - private->public
// public PlayerManager d; // Craftbukkit - removed! // public PlayerManager d; // CraftBukkit - removed!
public int e; // Craftbukkit - public public int e; // CraftBukkit - private->public
private Set f = new HashSet(); private Set f = new HashSet();
private Set g = new HashSet(); private Set g = new HashSet();
private Set h = new HashSet(); private Set h = new HashSet();
@ -57,7 +57,7 @@ public class ServerConfigurationManager {
this.k = minecraftserver.a("banned-ips.txt"); this.k = minecraftserver.a("banned-ips.txt");
this.l = minecraftserver.a("ops.txt"); this.l = minecraftserver.a("ops.txt");
this.m = minecraftserver.a("white-list.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.e = minecraftserver.d.a("max-players", 20);
this.o = minecraftserver.d.a("white-list", false); this.o = minecraftserver.d.a("white-list", false);
this.g(); this.g();
@ -71,23 +71,22 @@ public class ServerConfigurationManager {
} }
public void a(WorldServer worldserver) { public void a(WorldServer worldserver) {
// Craftbukkit start // CraftBukkit start
if (this.n == null) { if (this.n == null) {
this.n = worldserver.m().d(); this.n = worldserver.m().d();
} }
// Craftbukkit end // CraftBukkit end
} }
public int a() { public int a() {
return 144; // Craftbukkit - magic number from PlayerManager.b() (??) return 144; // CraftBukkit - magic number from PlayerManager.b() (??)
} }
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
this.b.add(entityplayer); this.b.add(entityplayer);
this.n.b(entityplayer); this.n.b(entityplayer);
// CraftBukkit start
// Craftbukkit start ((WorldServer) entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
((WorldServer)entityplayer.world).u.d((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4);
while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) { while (entityplayer.world.a(entityplayer, entityplayer.boundingBox).size() != 0) {
entityplayer.a(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ); 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))); server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_JOIN, server.getPlayer(entityplayer)));
((WorldServer)entityplayer.world).manager.a(entityplayer); ((WorldServer) entityplayer.world).manager.a(entityplayer);
// Craftbukkit end // CraftBukkit end
} }
public void b(EntityPlayer entityplayer) { public void b(EntityPlayer entityplayer) {
((WorldServer)entityplayer.world).manager.c(entityplayer); // Craftbukkit ((WorldServer) entityplayer.world).manager.c(entityplayer); // CraftBukkit
} }
public void c(EntityPlayer entityplayer) { public void c(EntityPlayer entityplayer) {
this.n.a(entityplayer); this.n.a(entityplayer);
entityplayer.world.d(entityplayer); // Craftbukkit entityplayer.world.d(entityplayer); // CraftBukkit
this.b.remove(entityplayer); this.b.remove(entityplayer);
// CraftBukkit start // 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 server.getPluginManager().callEvent(new PlayerEvent(PlayerEvent.Type.PLAYER_QUIT, server.getPlayer(entityplayer))); // CraftBukkit
// CraftBukkit end // CraftBukkit end
} }
@ -159,17 +158,17 @@ public class ServerConfigurationManager {
} }
public EntityPlayer d(EntityPlayer entityplayer) { 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.a(entityplayer);
this.c.k.b(entityplayer); this.c.k.b(entityplayer);
((WorldServer)entityplayer.world).manager.b(entityplayer); ((WorldServer) entityplayer.world).manager.b(entityplayer);
this.b.remove(entityplayer); this.b.remove(entityplayer);
entityplayer.world.e(entityplayer); entityplayer.world.e(entityplayer);
EntityPlayer entityplayer1 = new EntityPlayer(this.c, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world)); EntityPlayer entityplayer1 = new EntityPlayer(this.c, entityplayer.world, entityplayer.name, new ItemInWorldManager(entityplayer.world));
entityplayer1.id = entityplayer.id; entityplayer1.id = entityplayer.id;
entityplayer1.a = entityplayer.a; 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) { while (entityplayer.world.a(entityplayer1, entityplayer1.boundingBox).size() != 0) {
entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); entityplayer1.a(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
@ -178,42 +177,46 @@ public class ServerConfigurationManager {
// CraftBukkit start // CraftBukkit start
Player respawnPlayer = server.getPlayer(entityplayer); Player respawnPlayer = server.getPlayer(entityplayer);
Location respawnLocation = new Location(respawnPlayer.getWorld(), entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); 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 ); PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(Event.Type.PLAYER_RESPAWN, respawnPlayer, respawnLocation );
server.getPluginManager().callEvent(respawnEvent); server.getPluginManager().callEvent(respawnEvent);
entityplayer1.world = ((CraftWorld)respawnEvent.getRespawnLocation().getWorld()).getHandle();
entityplayer1.world = ((CraftWorld) respawnEvent.getRespawnLocation().getWorld()).getHandle();
entityplayer1.locX = respawnEvent.getRespawnLocation().getX(); entityplayer1.locX = respawnEvent.getRespawnLocation().getX();
entityplayer1.locY = respawnEvent.getRespawnLocation().getY(); entityplayer1.locY = respawnEvent.getRespawnLocation().getY();
entityplayer1.locZ = respawnEvent.getRespawnLocation().getZ(); entityplayer1.locZ = respawnEvent.getRespawnLocation().getZ();
entityplayer1.yaw = respawnEvent.getRespawnLocation().getYaw(); entityplayer1.yaw = respawnEvent.getRespawnLocation().getYaw();
entityplayer1.pitch = respawnEvent.getRespawnLocation().getPitch(); 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; 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 // CraftBukkit end
entityplayer1.a.b((Packet) (new Packet9Respawn())); entityplayer1.a.b((Packet) (new Packet9Respawn()));
entityplayer1.a.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); 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); entityplayer.world.a(entityplayer1);
// CraftBukkit end
this.b.add(entityplayer1); this.b.add(entityplayer1);
entityplayer1.l(); entityplayer1.l();
entityplayer1.s(); entityplayer1.s();
return entityplayer1; return entityplayer1;
// Craftbukkit end
} }
public void b() { public void b() {
// Craftbukkit start // CraftBukkit start
for (WorldServer world : c.worlds) { for (WorldServer world: c.worlds) {
world.manager.a(); 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) { public void a(int i, int j, int k, WorldServer world) {
world.manager.a(i, j, k); world.manager.a(i, j, k);
} }
// CraftBukkit end
public void a(Packet packet) { public void a(Packet packet) {
for (int i = 0; i < this.b.size(); ++i) { for (int i = 0; i < this.b.size(); ++i) {

Datei anzeigen

@ -2,7 +2,7 @@ package net.minecraft.server;
public class TileEntityChest extends TileEntity implements IInventory { public class TileEntityChest extends TileEntity implements IInventory {
private ItemStack[] a = new ItemStack[27]; //Craftbukkit private ItemStack[] a = new ItemStack[27]; // CraftBukkit
// CraftBukkit start // CraftBukkit start
public ItemStack[] getContents() { public ItemStack[] getContents() {

Datei anzeigen

@ -359,6 +359,7 @@ public class World implements IBlockAccess {
if (world != null) { if (world != null) {
BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l); BlockPhysicsEvent event = new BlockPhysicsEvent(Event.Type.BLOCK_PHYSICS, world.getBlockAt(i, j, k), l);
((WorldServer) this).getServer().getPluginManager().callEvent(event); ((WorldServer) this).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return; return;
} }
@ -712,7 +713,7 @@ public class World implements IBlockAccess {
flag = true; flag = true;
} }
//CraftBukkit start // CraftBukkit start
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
MobType type = null; MobType type = null;
@ -742,14 +743,13 @@ public class World implements IBlockAccess {
} }
if (type != null) { 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); Location loc = new Location(((WorldServer) this).getWorld(), entity.bi, entity.bj, entity.bk);
CreatureSpawnEvent cse; CreatureSpawnEvent event = new CreatureSpawnEvent(entity.getBukkitEntity(), type, loc);
cse = new CreatureSpawnEvent(entity.getBukkitEntity(), type, loc); server.getPluginManager().callEvent(event);
server.getPluginManager().callEvent(cse);
if (cse.isCancelled()) { if (event.isCancelled()) {
return false; 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 // 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); SpawnerCreature.a(this, this.D, this.E);
}
// CraftBukkit end // CraftBukkit end
this.o.a(); this.o.a();
@ -1621,7 +1622,7 @@ public class World implements IBlockAccess {
axisalignedbb = null; 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); 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) { if (!defaultReturn) {

Datei anzeigen

@ -2,17 +2,15 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
// CraftBukkit end
public class WorldGenBigTree extends WorldGenerator { public class WorldGenBigTree extends WorldGenerator {
static final byte[] a = new byte[] { (byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1}; static final byte[] a = new byte[] { (byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1};
Random b = new Random(); Random b = new Random();
// CraftBukkit start // CraftBukkit
BlockChangeDelegate c; BlockChangeDelegate c;
// CraftBukkit end
int[] d = new int[] { 0, 0, 0}; int[] d = new int[] { 0, 0, 0};
int e = 0; int e = 0;
int f; int f;
@ -344,7 +342,7 @@ public class WorldGenBigTree extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events // 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) { public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {

Datei anzeigen

@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
// CraftBukkit end
public class WorldGenForest extends WorldGenerator { public class WorldGenForest extends WorldGenerator {
@ -16,7 +15,7 @@ public class WorldGenForest extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events // 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) { public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {

Datei anzeigen

@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
// CraftBukkit end
public class WorldGenTaiga1 extends WorldGenerator { public class WorldGenTaiga1 extends WorldGenerator {
@ -16,7 +15,7 @@ public class WorldGenTaiga1 extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events // 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) { public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {

Datei anzeigen

@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
// CraftBukkit end
public class WorldGenTaiga2 extends WorldGenerator { public class WorldGenTaiga2 extends WorldGenerator {
@ -16,7 +15,7 @@ public class WorldGenTaiga2 extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events // 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) { public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {

Datei anzeigen

@ -2,9 +2,8 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
// CraftBukkit end
public class WorldGenTrees extends WorldGenerator { public class WorldGenTrees extends WorldGenerator {
@ -16,7 +15,7 @@ public class WorldGenTrees extends WorldGenerator {
// BlockChangeDelegate and then we can implicitly cast World to // BlockChangeDelegate and then we can implicitly cast World to
// WorldServer (a safe cast, AFAIK) and no code will be broken. This // WorldServer (a safe cast, AFAIK) and no code will be broken. This
// then allows plugins to catch manually-invoked generation events // 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) { public boolean generate(BlockChangeDelegate world, Random random, int i, int j, int k) {

Datei anzeigen

@ -3,12 +3,12 @@ package net.minecraft.server;
public class WorldManager implements IWorldAccess { public class WorldManager implements IWorldAccess {
private MinecraftServer a; private MinecraftServer a;
public WorldServer world; // Craftbukkit public WorldServer world; // CraftBukkit
// Craftbukkit - changed signature // CraftBukkit - changed signature
public WorldManager(MinecraftServer minecraftserver, WorldServer world) { public WorldManager(MinecraftServer minecraftserver, WorldServer world) {
this.a = minecraftserver; 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) {} 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() {}
public void a(int i, int j, int k) { 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) {} public void a(String s, int i, int j, int k) {}

Datei anzeigen

@ -1,11 +1,11 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
// CraftBukkit start // CraftBukkit start
import java.io.File;
import org.bukkit.BlockChangeDelegate; import org.bukkit.BlockChangeDelegate;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
@ -16,9 +16,9 @@ public class WorldServer extends World implements BlockChangeDelegate {
public ChunkProviderServer u; public ChunkProviderServer u;
public boolean v = false; public boolean v = false;
public boolean w; public boolean w;
public final MinecraftServer x; // Craftbukkit - private -> public final public final MinecraftServer x; // CraftBukkit - private -> public final
private EntityList y = new EntityList(); private EntityList y = new EntityList();
public PlayerManager manager; // Craftbukkit public PlayerManager manager; // CraftBukkit
public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) { public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i) {
super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i)); super(idatamanager, s, (new Random()).nextLong(), WorldProvider.a(i));
@ -87,7 +87,8 @@ public class WorldServer extends World implements BlockChangeDelegate {
i1 = l; 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) { 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) { 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); Explosion explosion = super.a(entity, d0, d1, d2, f, flag);
// Craftbukkit start // CraftBukkit start
if(explosion.wasCanceled) { if (explosion.wasCanceled) {
return explosion; return explosion;
} }
// Craftbukkit end // CraftBukkit end
this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g)); this.x.f.a(d0, d1, d2, 64.0D, new Packet60Explosion(d0, d1, d2, f, explosion.g));
return explosion; return explosion;