mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 21:47:55 +01:00
Added ItemSpawnEvent. Thanks myers!
This commit is contained in:
parent
5b93f5565a
commit
73e34c2fe3
@ -18,6 +18,7 @@ import org.bukkit.event.block.BlockCanBuildEvent;
|
|||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||||
import org.bukkit.event.block.SnowFormEvent;
|
import org.bukkit.event.block.SnowFormEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -820,6 +821,11 @@ public class World implements IBlockAccess {
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else if (entity instanceof EntityItem) {
|
||||||
|
ItemSpawnEvent event = CraftEventFactory.callItemSpawnEvent((EntityItem) entity);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity instanceof EntityLiving && entity instanceof EntityWaterAnimal && !this.allowAnimals) {
|
if (entity instanceof EntityLiving && entity instanceof EntityWaterAnimal && !this.allowAnimals) {
|
||||||
|
@ -7,6 +7,7 @@ import net.minecraft.server.EntityCreeper;
|
|||||||
import net.minecraft.server.EntityGhast;
|
import net.minecraft.server.EntityGhast;
|
||||||
import net.minecraft.server.EntityGiantZombie;
|
import net.minecraft.server.EntityGiantZombie;
|
||||||
import net.minecraft.server.EntityHuman;
|
import net.minecraft.server.EntityHuman;
|
||||||
|
import net.minecraft.server.EntityItem;
|
||||||
import net.minecraft.server.EntityLiving;
|
import net.minecraft.server.EntityLiving;
|
||||||
import net.minecraft.server.EntityMonster;
|
import net.minecraft.server.EntityMonster;
|
||||||
import net.minecraft.server.EntityPig;
|
import net.minecraft.server.EntityPig;
|
||||||
@ -40,6 +41,7 @@ import org.bukkit.event.block.BlockDamageEvent;
|
|||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
import org.bukkit.event.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.entity.EntityTameEvent;
|
import org.bukkit.event.entity.EntityTameEvent;
|
||||||
|
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
import org.bukkit.event.player.PlayerBucketEmptyEvent;
|
||||||
import org.bukkit.event.player.PlayerBucketFillEvent;
|
import org.bukkit.event.player.PlayerBucketFillEvent;
|
||||||
import org.bukkit.event.player.PlayerEvent;
|
import org.bukkit.event.player.PlayerEvent;
|
||||||
@ -243,4 +245,17 @@ public class CraftEventFactory {
|
|||||||
craftServer.getPluginManager().callEvent(event);
|
craftServer.getPluginManager().callEvent(event);
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ItemSpawnEvent
|
||||||
|
*/
|
||||||
|
public static ItemSpawnEvent callItemSpawnEvent(EntityItem entityitem) {
|
||||||
|
org.bukkit.entity.Entity entity = entityitem.getBukkitEntity();
|
||||||
|
CraftServer craftServer = (CraftServer) entity.getServer();
|
||||||
|
|
||||||
|
ItemSpawnEvent event = new ItemSpawnEvent(entity, entity.getLocation());
|
||||||
|
|
||||||
|
craftServer.getPluginManager().callEvent(event);
|
||||||
|
return event;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user