summaryrefslogtreecommitdiffstats
path: root/src/main/java/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net')
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java13
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderDragon.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderman.java11
-rw-r--r--src/main/java/net/minecraft/server/EntityPig.java12
-rw-r--r--src/main/java/net/minecraft/server/EntitySheep.java20
-rw-r--r--src/main/java/net/minecraft/server/EntitySlime.java4
-rw-r--r--src/main/java/net/minecraft/server/FoodMetaData.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemDye.java3
-rw-r--r--src/main/java/net/minecraft/server/ItemFood.java5
9 files changed, 20 insertions, 58 deletions
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 69e3ae9c..9ecbaca4 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -1,10 +1,6 @@
package net.minecraft.server;
-// CraftBukkit start
-import org.bukkit.craftbukkit.entity.CraftEntity;
-import org.bukkit.event.entity.ExplosionPrimeEvent;
-import org.bukkit.event.entity.CreeperPowerEvent;
-// CraftBukkit end
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
public class EntityCreeper extends EntityMonster {
@@ -115,7 +111,7 @@ public class EntityCreeper extends EntityMonster {
// CraftBukkit start
float radius = this.isPowered() ? 6.0F : 3.0F;
- ExplosionPrimeEvent event = new ExplosionPrimeEvent(CraftEntity.getEntity(this.world.getServer(), this), radius, false);
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), radius, false);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
@@ -152,10 +148,7 @@ public class EntityCreeper extends EntityMonster {
super.a(entityweatherlighting);
// CraftBukkit start
- CreeperPowerEvent event = new CreeperPowerEvent(this.getBukkitEntity(), entityweatherlighting.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING);
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callCreeperPowerEvent(this, entityweatherlighting, org.bukkit.event.entity.CreeperPowerEvent.PowerCause.LIGHTNING).isCancelled()) {
return;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index 36e73f30..37c70d9d 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -598,7 +598,7 @@ public class EntityEnderDragon extends EntityComplex {
byte b0 = 4;
// CraftBukkit start - Replace any "this.world" in the following with just "world"!
- EntityCreatePortalEvent event = new EntityCreatePortalEvent(this.getBukkitEntity(), new ArrayList<BlockState>(), PortalType.ENDER);
+ EntityCreatePortalEvent event = new EntityCreatePortalEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), new ArrayList<BlockState>(), PortalType.ENDER);
BlockStateListPopulator world = new BlockStateListPopulator(this.world.getWorld(), event.getBlocks());
for (int l = k - 1; l <= k + 32; ++l) {
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 7317466e..7e430803 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -6,7 +6,6 @@ import java.util.List;
import org.bukkit.Location;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityTeleportEvent;
-import org.bukkit.event.entity.EntityChangeBlockEvent;
// CraftBukkit end
public class EntityEnderman extends EntityMonster {
@@ -107,10 +106,7 @@ public class EntityEnderman extends EntityMonster {
l = this.world.getTypeId(i, j, k);
if (b[l]) {
// CraftBukkit start - pickup event
- EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR);
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
this.setCarriedId(this.world.getTypeId(i, j, k));
this.setCarriedData(this.world.getData(i, j, k));
this.world.setTypeId(i, j, k, 0);
@@ -129,10 +125,7 @@ public class EntityEnderman extends EntityMonster {
// CraftBukkit start - place event
org.bukkit.block.Block bblock = this.world.getWorld().getBlockAt(i, j, k);
- EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), bblock, bblock.getType());
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, bblock, bblock.getType()).isCancelled()) {
this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData());
this.setCarriedId(0);
}
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index 75d94a4b..bf1f9669 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -1,10 +1,5 @@
package net.minecraft.server;
-// CraftBukkit start
-import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
-import org.bukkit.event.entity.PigZapEvent;
-// CraftBukkit end
-
public class EntityPig extends EntityAnimal {
public EntityPig(World world) {
@@ -76,17 +71,14 @@ public class EntityPig extends EntityAnimal {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
// CraftBukkit start
- PigZapEvent event = new PigZapEvent(this.getBukkitEntity(), entityweatherlighting.getBukkitEntity(), entitypigzombie.getBukkitEntity());
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callPigZapEvent(this, entityweatherlighting, entitypigzombie).isCancelled()) {
return;
}
// CraftBukkit end
entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
// CraftBukkit - added a reason for spawning this creature
- this.world.addEntity(entitypigzombie, SpawnReason.LIGHTNING);
+ this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
this.die();
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index 28ac8070..77e9092a 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -5,7 +5,7 @@ import java.util.Random;
// CraftBukkit start
import org.bukkit.Material;
import org.bukkit.craftbukkit.event.CraftEventFactory;
-import org.bukkit.event.entity.EntityChangeBlockEvent;
+import org.bukkit.entity.Sheep;
// CraftBukkit end
public class EntitySheep extends EntityAnimal {
@@ -79,13 +79,7 @@ public class EntitySheep extends EntityAnimal {
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id) {
// CraftBukkit start
- org.bukkit.World bworld = this.world.getWorld();
- org.bukkit.block.Block bblock = bworld.getBlockAt(i, j, k);
-
- EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), bblock, Material.AIR);
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) {
this.world.f(2001, i, j, k, Block.LONG_GRASS.id + 256);
this.world.setTypeId(i, j, k, 0);
flag = true;
@@ -93,13 +87,7 @@ public class EntitySheep extends EntityAnimal {
// CraftBukkit end
} else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
// CraftBukkit start
- org.bukkit.World bworld = this.world.getWorld();
- org.bukkit.block.Block bblock = bworld.getBlockAt(i, j - 1, k);
-
- EntityChangeBlockEvent event = new EntityChangeBlockEvent(this.getBukkitEntity(), bblock, Material.DIRT);
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) {
this.world.f(2001, i, j - 1, k, Block.GRASS.id);
this.world.setTypeId(i, j - 1, k, Block.DIRT.id);
flag = true;
@@ -110,7 +98,7 @@ public class EntitySheep extends EntityAnimal {
if (flag) {
// CraftBukkit start
if (!this.isBaby()) {
- org.bukkit.event.entity.SheepRegrowWoolEvent event = new org.bukkit.event.entity.SheepRegrowWoolEvent(this.getBukkitEntity());
+ org.bukkit.event.entity.SheepRegrowWoolEvent event = new org.bukkit.event.entity.SheepRegrowWoolEvent((Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index bd14719c..3f2ea7f5 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.bukkit.entity.Slime;
+
public class EntitySlime extends EntityLiving implements IMonster {
public float a;
@@ -139,7 +141,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start
- org.bukkit.event.entity.SlimeSplitEvent event = new org.bukkit.event.entity.SlimeSplitEvent(this.getBukkitEntity(), j);
+ org.bukkit.event.entity.SlimeSplitEvent event = new org.bukkit.event.entity.SlimeSplitEvent((Slime) this.getBukkitEntity(), j);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled() && event.getCount() > 0) {
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index e6f5c2f0..66bb10b3 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -1,9 +1,6 @@
package net.minecraft.server;
-// CraftBukkit start
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.FoodLevelChangeEvent;
-// CraftBukkit end
+import org.bukkit.event.entity.EntityDamageEvent; // CraftBukkit
public class FoodMetaData {
@@ -36,8 +33,7 @@ public class FoodMetaData {
this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F);
} else if (i > 0) {
// CraftBukkit start
- FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.max(this.foodLevel - 1, 0));
- entityhuman.world.getServer().getPluginManager().callEvent(event);
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, Math.min(this.foodLevel - 1, 0));
if (!event.isCancelled()) {
this.foodLevel = event.getFoodLevel();
diff --git a/src/main/java/net/minecraft/server/ItemDye.java b/src/main/java/net/minecraft/server/ItemDye.java
index 1bb284b6..53cb505e 100644
--- a/src/main/java/net/minecraft/server/ItemDye.java
+++ b/src/main/java/net/minecraft/server/ItemDye.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import org.bukkit.entity.Player; // CraftBukkit
+import org.bukkit.entity.Sheep;
public class ItemDye extends Item {
@@ -115,7 +116,7 @@ public class ItemDye extends Item {
if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
// CraftBukkit start
byte bColor = new Integer(i).byteValue();
- org.bukkit.event.entity.SheepDyeWoolEvent event = new org.bukkit.event.entity.SheepDyeWoolEvent(entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
+ org.bukkit.event.entity.SheepDyeWoolEvent event = new org.bukkit.event.entity.SheepDyeWoolEvent((Sheep) entitysheep.getBukkitEntity(), org.bukkit.DyeColor.getByData(bColor));
entitysheep.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
index f870e814..43990a9a 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -1,7 +1,5 @@
package net.minecraft.server;
-import org.bukkit.event.entity.FoodLevelChangeEvent; // CraftBukkit
-
public class ItemFood extends Item {
public final int a;
@@ -31,8 +29,7 @@ public class ItemFood extends Item {
// CraftBukkit start
int oldFoodLevel = entityhuman.getFoodData().foodLevel;
- FoodLevelChangeEvent event = new FoodLevelChangeEvent(entityhuman.getBukkitEntity(), Math.min(this.getNutrition() + entityhuman.getFoodData().foodLevel, 20));
- entityhuman.world.getServer().getPluginManager().callEvent(event);
+ org.bukkit.event.entity.FoodLevelChangeEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callFoodLevelChangeEvent(entityhuman, Math.min(this.getNutrition() + oldFoodLevel, 20));
if (!event.isCancelled()) {
entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, this.getSaturationModifier());