[Bleeding] Implemented PotionSplashEvent. Closes BUKKIT-307

By: Zeerix <zeerix@draig.de>
This commit is contained in:
CraftBukkit/Spigot 2012-01-20 09:56:02 +01:00
parent 655b5d0aa9
commit 0342a99482

View file

@ -2,6 +2,7 @@ package org.bukkit.craftbukkit.event;
import java.net.InetAddress; import java.net.InetAddress;
import java.util.List; import java.util.List;
import java.util.Map;
import net.minecraft.server.ChunkCoordinates; import net.minecraft.server.ChunkCoordinates;
import net.minecraft.server.Entity; import net.minecraft.server.Entity;
@ -24,6 +25,7 @@ import net.minecraft.server.EntityMushroomCow;
import net.minecraft.server.EntityPig; import net.minecraft.server.EntityPig;
import net.minecraft.server.EntityPigZombie; import net.minecraft.server.EntityPigZombie;
import net.minecraft.server.EntityPlayer; import net.minecraft.server.EntityPlayer;
import net.minecraft.server.EntityPotion;
import net.minecraft.server.EntitySheep; import net.minecraft.server.EntitySheep;
import net.minecraft.server.EntitySilverfish; import net.minecraft.server.EntitySilverfish;
import net.minecraft.server.EntitySkeleton; import net.minecraft.server.EntitySkeleton;
@ -56,6 +58,7 @@ import org.bukkit.entity.Arrow;
import org.bukkit.entity.CreatureType; import org.bukkit.entity.CreatureType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Event.Type; import org.bukkit.event.Event.Type;
import org.bukkit.event.block.*; import org.bukkit.event.block.*;
import org.bukkit.event.entity.*; import org.bukkit.event.entity.*;
@ -65,6 +68,7 @@ import org.bukkit.event.player.*;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
public class CraftEventFactory { public class CraftEventFactory {
// helper methods
private static boolean canBuild(CraftWorld world, Player player, int x, int z) { private static boolean canBuild(CraftWorld world, Player player, int x, int z) {
WorldServer worldServer = world.getHandle(); WorldServer worldServer = world.getHandle();
int spawnSize = Bukkit.getServer().getSpawnRadius(); int spawnSize = Bukkit.getServer().getSpawnRadius();
@ -321,6 +325,17 @@ public class CraftEventFactory {
return event; return event;
} }
/**
* PotionSplashEvent
*/
public static PotionSplashEvent callPotionSplashEvent(EntityPotion potion, Map<LivingEntity, Double> affectedEntities) {
ThrownPotion thrownPotion = (ThrownPotion) potion.getBukkitEntity();
PotionSplashEvent event = new PotionSplashEvent(thrownPotion, affectedEntities);
Bukkit.getPluginManager().callEvent(event);
return event;
}
/** /**
* BlockFadeEvent * BlockFadeEvent
*/ */