Whats going on here?

Discussion in 'Plugin Development' started by CheifKeef, Jun 19, 2014.

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

    CheifKeef

    I want the potion effect to be Nausea II for 60 Seconds but it only lasts for 2 seconds wtf:

    package me.Yongblood11.Marajuana;

    import org.bukkit.Material;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.block.Action;
    import org.bukkit.event.player.PlayerInteractEvent;
    import org.bukkit.plugin.java.JavaPlugin;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;

    public class Weed extends JavaPlugin
    implements Listener
    {
    public void onEnable()
    {
    getServer().getPluginManager().registerEvents(this, this);
    }

    @EventHandler
    public void onClick(PlayerInteractEvent event) {
    if ((event.getAction() != Action.RIGHT_CLICK_AIR) && (event.getAction() != Action.RIGHT_CLICK_BLOCK)) return;
    Player p = event.getPlayer();
    if (p.getItemInHand() == null) return;
    if (p.getItemInHand().getType() != Material.WHEAT) return;
    p.sendMessage("§c[§bMarajuana§c] §7You have smoked bomb ass kush!");
    p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 60, 60));
    }
    }
    other than this it works fine.
     
  2. Offline

    fefe2008

    CheifKeef The Potion Effect time is in ticks. 20 ticks = 1 second .
    You do the math now

    p.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, duration, strength));

    Setting the strength arg to 0 will provide nausea 1 ingame setting it to 1 will give you nausea 2
     
  3. Offline

    Laxer21117

    Code:java
    1. e.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 1));


    That should work.
     
  4. Offline

    teej107

    CheifKeef Please use the code syntax from now on when posting code. I didn't even read your code because you didn't use the syntax. TLDNR
     
  5. Online

    timtower Administrator Administrator Moderator

    CheifKeef And why exactly are you requesting a plugin and then asking on here what is wrong with it with your own package?
     
  6. Offline

    fefe2008

    timtower That my friend , is what I call a code stealing giraffe
     
    teej107, Garris0n and timtower like this.
  7. Offline

    Iroh

    Locked.
    We do not support modifying existing plugins.
     
Thread Status:
Not open for further replies.

Share This Page