Problem with onProjectileHit event with thrown potions

Discussion in 'Plugin Development' started by cheddar262, Jan 8, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    cheddar262

    Okay, I keep trying to see if a trigger would happen on the onProjectileHit event with a thrown potion (Which someone told me works in the bukkitdev irc). I never get any of my debug stuff in the console. I have no idea why I'm not. Here's my code so far:
    Code:
    package me.cheddar262.PotionBlockerSponge;
    
    import java.util.logging.Logger;
    import org.bukkit.event.Event;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class PotionBlockerSponge extends JavaPlugin{
    
        Logger log = Logger.getLogger("Minecraft");
        private final PotionLocationDetectorEntityListener entityListener = new PotionLocationDetectorEntityListener(this);
    
        public void onEnable() {
    
            PluginManager pm = getServer().getPluginManager();
    
            log.info("PotionLocationDetector has been enabled!");
    
            pm.registerEvent(Event.Type.PROJECTILE_HIT, this.entityListener, Event.Priority.Normal, this);
        }
        public void onDisable() {
            log.info("PotionLocationDetector has been disabled.");
    
        }
    
    }
    
    Above is my main class

    Below is my entityListener class
    Code:
    package me.cheddar262.PotionBlockerSponge;
    
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.ThrownPotion;
    import org.bukkit.event.entity.EntityListener;
    import org.bukkit.event.entity.ProjectileHitEvent;
    
    public class PotionLocationDetectorEntityListener extends EntityListener{
    
        public PotionBlockerSponge plugin;
    
        public PotionLocationDetectorEntityListener (PotionBlockerSponge instance) {
            plugin = instance;
        }
        public void onProjectileHit(ProjectileHitEvent event) {
            plugin.log.info("Got to here");
            Entity e = event.getEntity();
            if(e instanceof ThrownPotion){
                plugin.log.info("Projectile hit at: " + e.getLocation());
            }
        }
    
    }
    
    I don't get the "Got to here" or the "Projectile hit at: " messages.
    I honestly have no idea what's wrong at all...
     
  2. Either they forgot to make potions fire the event or they're just not supposed to fire the event.
     
  3. Offline

    phrstbrn

Thread Status:
Not open for further replies.

Share This Page