I'm using: Craftbukkit 1.7.2 Disguisecraft API And making my own kits. How do I remove Potion effects and Disguises (With Disguisecraft API) when they die? I know it's a DeathEvent handler, but I can't think how to do it... If you need the code for one of the free kits, you can. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
ESSHD You can... what? Perhaps you can find what you need here: http://dev.bukkit.org/bukkit-plugins/disguisecraft/pages/developer-api/
That's where I've been looking.... I just need to be able to remove Disguises to the regular player, and Remove Potions on death Would this be right? Code: Player p; public void onPlayerDeath(PlayerDeathEvent e){ if (e.getEntity() instanceof Player){ PlayerUndisguiseEvent(); p.removePotionEffect(PotionEffectType.JUMP); p.removePotionEffect(PotionEffectType.REGENERATION); p.removePotionEffect(PotionEffectType.SPEED); p.removePotionEffect(PotionEffectType.FIRE_RESISTANCE); } } private void PlayerUndisguiseEvent() { new Disguise(api.newEntityID(), p.getName(), DisguiseType.Player); } The Gaming Grunts EDIT by Moderator: merged posts, please use the edit button instead of double posting.
ESSHD Why not try it and see if it works? Also, why are you just creating a random player variable? Simply use e.getEntity() in the event or do "Player p = e.getEntity();".
ESSHD Along with what The Gaming Grunts mentioned, remember to add the @EventHandler tag on your event or it won't work! (Also, register events)
It didn't work... Got any more ideas? The Gaming Grunts, AoH_Ruthless? EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Code: @EventHandler(priority=EventPriority.HIGH) public void onPlayerDeath(PlayerDeathEvent event) { Player player = event.getEntity(); player.removePotionEffect(PotionEffectType.JUMP); player.removePotionEffect(PotionEffectType.REGENERATION); player.removePotionEffect(PotionEffectType.FIRE_RESISTANCE); player.removePotionEffect(PotionEffectType.SPEED); } How is this not working? I don't understand...
ESSHD I recently encountered a similar situation where I wanted one event to trigger another event... You would have to do something like this: Code:java CustomEvent customEvent = new CustomEvent(e.getEntity().getPlayer());Bukkit.getServer().getPluginManager().callEvent(customEvent);if (customEvent.isCancelled()) {getLogger().warning("something has attempted to cancel customEvent !");}customEvent.doSomething(args); Obviously, you'll want to replace CustomEvent with the specific event that you want to trigger. Also, for whatever Event that you want to trigger, you'll want to look at the constructors to see what parameters it takes: e.getEntity().getPlayer() was just an example parameter. Hopefully this helps.