Archiviert
13
0

Entity audit. Adds checks for null entities, and adds conformity.

Dieser Commit ist enthalten in:
Andrew Ardill 2011-01-21 16:54:30 +11:00
Ursprung 1dad7de4f3
Commit 1cbde901ba
34 geänderte Dateien mit 211 neuen und 173 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,6 @@
package net.minecraft.server;
// CraftBukkit start
import org.bukkit.entity.LivingEntity;
import org.bukkit.craftbukkit.block.CraftBlock;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
@ -102,7 +97,7 @@ public class BlockCactus extends Block {
if(entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) world).getServer();
org.bukkit.block.Block damager = ((WorldServer) world).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = entity.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.CONTACT;
int damageDone = 1;

Datei anzeigen

@ -1,13 +1,13 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//CraftBukkit end
// CraftBukkit end
import java.util.List;
import java.util.Random;
@ -76,7 +76,7 @@ public abstract class Entity {
public int ai;
public int aj;
protected org.bukkit.entity.Entity bukkitEntity; //CraftBukkit
protected org.bukkit.entity.Entity bukkitEntity; // CraftBukkit
public Entity(World world) {
g = a++;
@ -117,7 +117,7 @@ public abstract class Entity {
af.a(0, ((Byte.valueOf((byte) 0))));
a();
bukkitEntity = null; //CraftBukkit
bukkitEntity = null; // CraftBukkit
}
protected abstract void a();
@ -489,7 +489,7 @@ public abstract class Entity {
b(1);
if (!flag2) {
Z++;
//CraftBukkit start
// CraftBukkit start
if(Z <= 0){
// not on fire yet
CraftServer server = ((WorldServer) l).getServer();
@ -506,7 +506,7 @@ public abstract class Entity {
// reset fire level back to max
Z = 300;
}
//CraftBukkit end
// CraftBukkit end
}
} else if (Z <= 0) {
Z = -Y;
@ -922,7 +922,7 @@ public abstract class Entity {
// e(null) doesn't really fly for overloaded methods,
// so this method is needed
//CraftBukkit end
// CraftBukkit end
d = 0.0D;
e = 0.0D;
@ -982,9 +982,9 @@ public abstract class Entity {
}
}
//CraftBukkit start
// CraftBukkit start
public org.bukkit.entity.Entity getBukkitEntity(){
return this.bukkitEntity;
}
//CraftBukkit end
// CraftBukkit end
}

Datei anzeigen

@ -1,18 +1,18 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftAnimals;
//CraftBukkit end
// CraftBukkit end
public abstract class EntityAnimals extends EntityCreature implements IAnimals {
public EntityAnimals(World world) {
super(world);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftAnimals(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected float a(int i, int j, int k) {

Datei anzeigen

@ -2,13 +2,13 @@ package net.minecraft.server;
import java.util.List;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftArrow;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//CraftBukkit end
// CraftBukkit end
public class EntityArrow extends Entity {
@ -34,10 +34,10 @@ public class EntityArrow extends Entity {
am = 0;
a(0.5F, 0.5F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftArrow(server, this);
//CraftBukkit end
// CraftBukkit end
}
public EntityArrow(World world, double d1, double d2, double d3) {

Datei anzeigen

@ -9,6 +9,7 @@ import org.bukkit.craftbukkit.entity.CraftBoat;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.CraftMappable;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.Event.Type;
import org.bukkit.event.vehicle.VehicleCreateEvent;
@ -50,10 +51,10 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
M = false;
handleCreation(world); // CraftBukkit
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftBoat(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {}
@ -86,7 +87,9 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
// CraftBukkit start
private void handleCreation(World world) {
CraftServer server = ((WorldServer) world).getServer();
VehicleCreateEvent event = new VehicleCreateEvent( Type.VEHICLE_CREATE, (Vehicle) this.getBukkitEntity());
Type eventType = Type.VEHICLE_CREATE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
server.getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -97,7 +100,12 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
public boolean a(Entity entity, int i) {
// CraftBukkit start
VehicleDamageEvent event = new VehicleDamageEvent( Type.VEHICLE_DAMAGE, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity(), i);
Type eventType = Type.VEHICLE_DAMAGE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (entity == null)?null:entity.getBukkitEntity();
int damage = i;
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, attacker, damage);
((WorldServer) l).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -290,7 +298,13 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
// CraftBukkit start
CraftServer server = ((WorldServer)l).getServer();
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, (Vehicle) this.getBukkitEntity(), new Location(((WorldServer)l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), new Location(((WorldServer)l).getWorld(), p, q, r, v, w));
CraftWorld world = ((WorldServer)l).getWorld();
Type eventType = Type.VEHICLE_MOVE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
Location to = new Location(world, p, q, r, v, w);
VehicleMoveEvent event = new VehicleMoveEvent(eventType, vehicle, from, to);
server.getPluginManager().callEvent(event);
// CraftBukkit end
@ -325,7 +339,11 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
// CraftBukkit start
public void c(Entity entity) {
CraftServer server = ((WorldServer)l).getServer();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent( Type.VEHICLE_COLLISION_ENTITY, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity hitEntity = (entity == null)?null:entity.getBukkitEntity();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity);
server.getPluginManager().callEvent(collsionEvent);
if (collsionEvent.isCancelled()) {
@ -347,7 +365,11 @@ public class EntityBoat extends Entity implements CraftMappable { // CraftBukkit
if (!l.z) {
// CraftBukkit start
CraftServer server = ((WorldServer)l).getServer();
VehicleEnterEvent event = new VehicleEnterEvent( Type.VEHICLE_ENTER, (Vehicle) this.getBukkitEntity(), entityplayer.getBukkitEntity());
Type eventType = Type.VEHICLE_ENTER;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity player = entityplayer.getBukkitEntity();
VehicleEnterEvent event = new VehicleEnterEvent(eventType, vehicle, player);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftChicken;
//CraftBukkit end
// CraftBukkit end
public class EntityChicken extends EntityAnimals {
@ -27,10 +27,10 @@ public class EntityChicken extends EntityAnimals {
a(0.3F, 0.4F);
aZ = 4;
am = W.nextInt(6000) + 6000;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftChicken(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void o() {

Datei anzeigen

@ -1,9 +1,9 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftCow;
//CraftBukkit end
// CraftBukkit end
public class EntityCow extends EntityAnimals {
@ -11,10 +11,10 @@ public class EntityCow extends EntityAnimals {
super(world);
aP = "/mob/cow.png";
a(0.9F, 1.3F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftCow(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void a(NBTTagCompound nbttagcompound) {

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftCreature;
//CraftBukkit end
// CraftBukkit end
public class EntityCreature extends EntityLiving {
@ -16,10 +16,10 @@ public class EntityCreature extends EntityLiving {
public EntityCreature(World world) {
super(world);
e = false;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftCreature(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void d() {

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftCreeper;
//CraftBukkit end
// CraftBukkit end
public class EntityCreeper extends EntityMobs {
@ -15,10 +15,10 @@ public class EntityCreeper extends EntityMobs {
public EntityCreeper(World world) {
super(world);
aP = "/mob/creeper.png";
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftCreeper(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {

Datei anzeigen

@ -37,10 +37,10 @@ public class EntityEgg extends Entity {
a = 0;
am = 0;
a(0.25F, 0.25F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftEgg(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {}
@ -176,7 +176,7 @@ public class EntityEgg extends Entity {
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
//TODO @see EntityArrow#162
// TODO @see EntityArrow#162
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(edbpe);
@ -196,7 +196,7 @@ public class EntityEgg extends Entity {
}
}
// Craftbukkit start
// CraftBukkit start
boolean hatching = !this.l.z && W.nextInt(8) == 0;
byte numHatching = (hatching && W.nextInt(32) == 0) ? (byte) 4 : (byte) 1;
if (!hatching) {
@ -207,7 +207,7 @@ public class EntityEgg extends Entity {
if (ak instanceof EntityPlayerMP) {
CraftServer server = ((WorldServer) l).getServer();
Type eventType = Type.PLAYER_EGG_THROW;
Player player = (Player) ak.getBukkitEntity();
Player player = (ak == null)?null:(Player) ak.getBukkitEntity();
PlayerEggThrowEvent event = new PlayerEggThrowEvent(eventType, player, hatching, numHatching, hatchingType);
server.getPluginManager().callEvent(event);

Datei anzeigen

@ -1,9 +1,9 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftFallingSand;
//CraftBukkit end
// CraftBukkit end
public class EntityFallingSand extends Entity {
@ -13,11 +13,16 @@ public class EntityFallingSand extends Entity {
public EntityFallingSand(World world) {
super(world);
b = 0;
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftFallingSand(server, this);
// CraftBukkit end
}
public EntityFallingSand(World world, double d, double d1, double d2, int i) {
super(world);
b = 0;
// CraftBukkit start
this(world);
// CraftBukkit end
a = i;
this.i = true;
a(0.98F, 0.98F);
@ -30,10 +35,6 @@ public class EntityFallingSand extends Entity {
m = d;
n = d1;
o = d2;
//CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftFallingSand(server, this);
//CraftBukkit end
}
protected void a() {}

Datei anzeigen

@ -3,13 +3,13 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftFireball;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//CraftBukkit end
// CraftBukkit end
public class EntityFireball extends Entity {
@ -38,10 +38,10 @@ public class EntityFireball extends Entity {
ap = 0;
a(1.0F, 1.0F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftFireball(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {}
@ -141,7 +141,7 @@ public class EntityFireball extends Entity {
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
//TODO @see EntityArrow#162
// TODO @see EntityArrow#162
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(edbpe);

Datei anzeigen

@ -9,7 +9,7 @@ import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//CraftBukkit end
// CraftBukkit end
public class EntityFish extends Entity {
@ -197,7 +197,7 @@ public class EntityFish extends Entity {
if (movingobjectposition != null) {
if (movingobjectposition.g != null) {
// CraftBukkit start
//TODO add EntityDamagedByProjectileEvent : fishing hook?
// TODO add EntityDamagedByProjectileEvent : fishing hook?
boolean bounce;
if (movingobjectposition.g instanceof EntityLiving) {
CraftServer server = ((WorldServer) this.l).getServer();
@ -207,7 +207,7 @@ public class EntityFish extends Entity {
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
//TODO @see EntityArrow#162
// TODO @see EntityArrow#162
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(edbpe);

Datei anzeigen

@ -1,18 +1,18 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftFlying;
//CraftBukkit end
// CraftBukkit end
public class EntityFlying extends EntityLiving {
public EntityFlying(World world) {
super(world);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftFlying(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a(float f) {}

Datei anzeigen

@ -3,10 +3,10 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftGhast;
//CraftBukkit end
// CraftBukkit end
public class EntityGhast extends EntityFlying implements IMobs {
@ -29,10 +29,10 @@ public class EntityGhast extends EntityFlying implements IMobs {
aP = "/mob/ghast.png";
a(4F, 4F);
ae = true;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftGhast(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void d() {

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftItem;
//CraftBukkit end
// CraftBukkit end
public class EntityItem extends Entity {
@ -17,12 +17,9 @@ public class EntityItem extends Entity {
public float d;
public EntityItem(World world, double d1, double d2, double d3, ItemStack itemstack) {
super(world);
b = 0;
f = 5;
d = (float) (Math.random() * 3.1415926535897931D * 2D);
a(0.25F, 0.25F);
H = J / 2.0F;
// CraftBukkit start
this(world);
// CraftBukkit end
a(d1, d2, d3);
a = itemstack;
v = (float) (Math.random() * 360D);
@ -30,10 +27,7 @@ public class EntityItem extends Entity {
t = 0.20000000298023224D;
u = (float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D);
M = false;
//CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftItem(server, this);
//CraftBukkit end
}
public EntityItem(World world) {
@ -43,6 +37,10 @@ public class EntityItem extends Entity {
d = (float) (Math.random() * 3.1415926535897931D * 2D);
a(0.25F, 0.25F);
H = J / 2.0F;
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftItem(server, this);
// CraftBukkit end
}
protected void a() {}

Datei anzeigen

@ -3,13 +3,12 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
//CraftBukkit end
import org.bukkit.event.entity.EntityDamageByBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
// CraftBukkit end
public abstract class EntityLiving extends Entity {
@ -101,10 +100,10 @@ public abstract class EntityLiving extends Entity {
aG = (float) Math.random() * 12398F;
v = (float) (Math.random() * 3.1415927410125732D * 2D);
S = 0.5F;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftLivingEntity(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {}

Datei anzeigen

@ -9,6 +9,7 @@ import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftPoweredMinecart;
import org.bukkit.craftbukkit.entity.CraftStorageMinecart;
import org.bukkit.craftbukkit.CraftMappable;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.craftbukkit.entity.CraftMinecart;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Vehicle;
@ -133,12 +134,12 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
M = false;
handleCreation(world); // CraftBukkit
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftMinecart(server, this);
this.bukkitPoweredMinecart = new CraftPoweredMinecart(server, this);
this.bukkitStorageMinecart = new CraftStorageMinecart(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {}
@ -172,7 +173,10 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
// CraftBukkit start
private void handleCreation(World world) {
CraftServer server = ((WorldServer) world).getServer();
VehicleCreateEvent event = new VehicleCreateEvent(Type.VEHICLE_CREATE, (Vehicle) this.getBukkitEntity());
Type eventType = Type.VEHICLE_CREATE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
VehicleCreateEvent event = new VehicleCreateEvent(eventType, vehicle);
server.getPluginManager().callEvent(event);
}
// CraftBukkit end
@ -183,11 +187,12 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
public boolean a(Entity entity, int i) {
// CraftBukkit start
org.bukkit.entity.Entity passenger = null;
if ((EntityLiving)entity != null) {
passenger = entity.getBukkitEntity();
}
VehicleDamageEvent event = new VehicleDamageEvent(Type.VEHICLE_DAMAGE, (Vehicle) this.getBukkitEntity(), passenger, i);
Type eventType = Type.VEHICLE_DAMAGE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity passenger = (entity == null)?null:entity.getBukkitEntity();
int damage = i;
VehicleDamageEvent event = new VehicleDamageEvent(eventType, vehicle, passenger, damage);
((WorldServer)l).getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -510,7 +515,13 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
// CraftBukkit start
CraftServer server = ((WorldServer)this.l).getServer();
VehicleMoveEvent event = new VehicleMoveEvent(Type.VEHICLE_MOVE, (Vehicle) this.getBukkitEntity(), new Location(((WorldServer)this.l).getWorld(), prevX, prevY, prevZ, prevYaw, prevPitch), new Location(((WorldServer)this.l).getWorld(), p, q, r, v, w));
CraftWorld world = ((WorldServer)this.l).getWorld();
Type eventType = Type.VEHICLE_MOVE;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
Location from = new Location(world, prevX, prevY, prevZ, prevYaw, prevPitch);
Location to = new Location(world, p, q, r, v, w);
VehicleMoveEvent event = new VehicleMoveEvent(eventType , vehicle , from, to);
server.getPluginManager().callEvent(event);
// CraftBukkit end
@ -646,7 +657,11 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
// CraftBukkit start
CraftServer server = ((WorldServer)l).getServer();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(Type.VEHICLE_COLLISION_ENTITY, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
Type eventType = Type.VEHICLE_COLLISION_ENTITY;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity hitEntity = (entity == null)?null:entity.getBukkitEntity();
VehicleEntityCollisionEvent collsionEvent = new VehicleEntityCollisionEvent(eventType, vehicle, hitEntity);
server.getPluginManager().callEvent(collsionEvent);
if (collsionEvent.isCancelled()) {
@ -655,7 +670,9 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
if ((entity instanceof EntityLiving) && !(entity instanceof EntityPlayer) && d == 0 && s * s + u * u > 0.01D && j == null && entity.k == null) {
if (!collsionEvent.isPickupCancelled()) {
VehicleEnterEvent enterEvent = new VehicleEnterEvent(Type.VEHICLE_ENTER, (Vehicle) this.getBukkitEntity(), entity.getBukkitEntity());
eventType = Type.VEHICLE_ENTER;
VehicleEnterEvent enterEvent = new VehicleEnterEvent(eventType, vehicle, hitEntity);
server.getPluginManager().callEvent(enterEvent);
if (!enterEvent.isCancelled()) {
@ -772,7 +789,11 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
if (!l.z) {
// CraftBukkit start
CraftServer server = ((WorldServer) l).getServer();
VehicleEnterEvent event = new VehicleEnterEvent(Type.VEHICLE_ENTER, (Vehicle) this.getBukkitEntity(), entityplayer.getBukkitEntity());
Type eventType = Type.VEHICLE_ENTER;
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity player = (entityplayer == null)?null:entityplayer.getBukkitEntity();
VehicleEnterEvent event = new VehicleEnterEvent(eventType, vehicle, player);
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
@ -808,7 +829,7 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
return entityplayer.b(((Entity) (this))) <= 64D;
}
//CraftBukkit start
// CraftBukkit start
@Override
public org.bukkit.entity.Entity getBukkitEntity(){
if (this.d == CraftMinecart.Type.StorageMinecart.getId()) {
@ -819,5 +840,5 @@ public class EntityMinecart extends Entity implements IInventory, CraftMappable
return this.bukkitEntity;
}
}
//CraftBukkit end
// CraftBukkit end
}

Datei anzeigen

@ -2,14 +2,14 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftMonster;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//CraftBukkit end
// CraftBukkit end
public class EntityMobs extends EntityCreature implements IMobs {
@ -19,10 +19,10 @@ public class EntityMobs extends EntityCreature implements IMobs {
super(world);
c = 2;
aZ = 20;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftMonster(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void o() {
@ -72,7 +72,7 @@ public class EntityMobs extends EntityCreature implements IMobs {
if(entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) l).getServer();
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = entity.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damageDone = c;

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.*;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPainting;
//CraftBukkit end
// CraftBukkit end
public class EntityPainting extends Entity {
@ -22,10 +22,10 @@ public class EntityPainting extends Entity {
a = 0;
H = 0.0F;
a(0.5F, 0.5F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftPainting(server, this);
//CraftBukkit end
// CraftBukkit end
}
public EntityPainting(World world, int i, int j, int k, int l) {

Datei anzeigen

@ -1,9 +1,9 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPig;
//CraftBukkit end
// CraftBukkit end
public class EntityPig extends EntityAnimals {
@ -11,10 +11,10 @@ public class EntityPig extends EntityAnimals {
super(world);
aP = "/mob/pig.png";
a(0.9F, 0.9F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftPig(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {

Datei anzeigen

@ -3,10 +3,10 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPigZombie;
//CraftBukkit end
// CraftBukkit end
public class EntityPigZombie extends EntityZombie {
@ -22,10 +22,10 @@ public class EntityPigZombie extends EntityZombie {
bC = 0.5F;
c = 5;
ae = true;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftPigZombie(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void b_() {

Datei anzeigen

@ -3,13 +3,13 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
//CraftBukkit end
// CraftBukkit end
public abstract class EntityPlayer extends EntityLiving {
@ -51,10 +51,10 @@ public abstract class EntityPlayer extends EntityLiving {
aR = 180F;
Y = 20;
aP = "/mob/char.png";
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftHumanEntity(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void b_() {
@ -343,7 +343,7 @@ public abstract class EntityPlayer extends EntityLiving {
if(entity instanceof EntityLiving) {
CraftServer server = ((WorldServer) l).getServer();
org.bukkit.entity.Entity damager = this.getBukkitEntity();
org.bukkit.entity.Entity damagee = entity.getBukkitEntity();
org.bukkit.entity.Entity damagee = (entity == null)?null:entity.getBukkitEntity();
DamageCause damageType = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damageDone = i;

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.*;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftPlayer;
//CraftBukkit end
// CraftBukkit end
public class EntityPlayerMP extends EntityPlayer implements ICrafting {
@ -48,10 +48,10 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
aw = s;
c = iteminworldmanager;
H = 0.0F;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftPlayer(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void l() {
@ -200,7 +200,7 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting {
// e(null) doesn't really fly for overloaded methods,
// so this method is needed
//CraftBukkit end
// CraftBukkit end
super.setPassengerOf(entity);
a.b(((Packet) (new Packet39(((Entity) (this)), k))));
a.a(p, q, r, v, w);

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftSheep;
//CraftBukkit end
// CraftBukkit end
public class EntitySheep extends EntityAnimals {
@ -49,10 +49,10 @@ public class EntitySheep extends EntityAnimals {
super(world);
aP = "/mob/sheep.png";
a(0.9F, 1.3F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSheep(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {

Datei anzeigen

@ -2,7 +2,7 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftSkeleton;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
@ -16,10 +16,10 @@ public class EntitySkeleton extends EntityMobs {
public EntitySkeleton(World world) {
super(world);
aP = "/mob/skeleton.png";
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSkeleton(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected String e() {
@ -41,7 +41,9 @@ public class EntitySkeleton extends EntityMobs {
if (f1 > 0.5F && l.i(MathHelper.b(p), MathHelper.b(q), MathHelper.b(r)) && W.nextFloat() * 30F < (f1 - 0.4F) * 2.0F) {
// CraftBukkit start
CraftServer server = ((WorldServer) l).getServer();
EntityCombustEvent event = new EntityCombustEvent(Type.ENTITY_COMBUST, this.getBukkitEntity());
Type eventType = Type.ENTITY_COMBUST;
org.bukkit.entity.Entity entity = this.getBukkitEntity();
EntityCombustEvent event = new EntityCombustEvent(eventType, entity);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
Z = 300;

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftSlime;
//CraftBukkit stop
// CraftBukkit stop
public class EntitySlime extends EntityLiving implements IMobs {
@ -23,10 +23,10 @@ public class EntitySlime extends EntityLiving implements IMobs {
H = 0.0F;
d = W.nextInt(20) + 10;
a(c);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSlime(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void a(int j) {

Datei anzeigen

@ -3,13 +3,13 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftSnowball;
import org.bukkit.event.entity.EntityDamageByProjectileEvent;
import org.bukkit.event.entity.EntityDamageEvent;
//CraftBukkit end
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
// CraftBukkit end
public class EntitySnowball extends Entity {
@ -33,10 +33,10 @@ public class EntitySnowball extends Entity {
a = 0;
am = 0;
a(0.25F, 0.25F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSnowball(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected void a() {}
@ -172,7 +172,7 @@ public class EntitySnowball extends Entity {
DamageCause damageCause = EntityDamageEvent.DamageCause.ENTITY_ATTACK;
int damage = 0;
//TODO @see EntityArrow#162
// TODO @see EntityArrow#162
EntityDamageByProjectileEvent edbpe = new EntityDamageByProjectileEvent(shooter, damagee, projectile, damageCause, damage);
server.getPluginManager().callEvent(edbpe);

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftSpider;
//CraftBukkit stop
// CraftBukkit stop
public class EntitySpider extends EntityMobs {
@ -14,10 +14,10 @@ public class EntitySpider extends EntityMobs {
aP = "/mob/spider.png";
a(1.4F, 0.9F);
bC = 0.8F;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSpider(server, this);
//CraftBukkit end
// CraftBukkit end
}
public double k() {

Datei anzeigen

@ -2,10 +2,10 @@ package net.minecraft.server;
import java.util.Random;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftSquid;
//CraftBukkit stop
// CraftBukkit stop
public class EntitySquid extends EntityWaterMob {
@ -43,10 +43,10 @@ public class EntitySquid extends EntityWaterMob {
aP = "/mob/squid.png";
a(0.95F, 0.95F);
ap = (1.0F / (W.nextFloat() + 1.0F)) * 0.2F;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftSquid(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void a(NBTTagCompound nbttagcompound) {

Datei anzeigen

@ -1,9 +1,9 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftTNTPrimed;
//CraftBukkit stop
// CraftBukkit stop
public class EntityTNTPrimed extends Entity {
@ -15,10 +15,10 @@ public class EntityTNTPrimed extends Entity {
i = true;
a(0.98F, 0.98F);
H = J / 2.0F;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftTNTPrimed(server, this);
//CraftBukkit end
// CraftBukkit end
}
public EntityTNTPrimed(World world, double d1, double d2, double d3) {

Datei anzeigen

@ -1,18 +1,18 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftWaterMob;
//CraftBukkit stop
// CraftBukkit stop
public class EntityWaterMob extends EntityCreature implements IAnimals {
public EntityWaterMob(World world) {
super(world);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftWaterMob(server, this);
//CraftBukkit end
// CraftBukkit end
}
public boolean d_() {

Datei anzeigen

@ -1,6 +1,6 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftZombie;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.event.Event.Type;
@ -14,10 +14,10 @@ public class EntityZombie extends EntityMobs {
aP = "/mob/zombie.png";
bC = 0.5F;
c = 5;
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftZombie(server, this);
//CraftBukkit end
// CraftBukkit end
}
public void o() {

Datei anzeigen

@ -1,9 +1,9 @@
package net.minecraft.server;
//CraftBukkit start
// CraftBukkit start
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.entity.CraftGiant;
//CraftBukkit stop
// CraftBukkit stop
public class EntityZombieSimple extends EntityMobs {
@ -15,10 +15,10 @@ public class EntityZombieSimple extends EntityMobs {
aZ *= 10;
H *= 6F;
a(I * 6F, J * 6F);
//CraftBukkit start
// CraftBukkit start
CraftServer server = ((WorldServer) this.l).getServer();
this.bukkitEntity = new CraftGiant(server, this);
//CraftBukkit end
// CraftBukkit end
}
protected float a(int i, int j, int k) {