1. Welcome to the Brawl website! Feel free to look around our forums. Join our growing community by typing /register in-game!

PainKillerPerk V2.0

Discussion in 'Ideas' started by Darkchaosknight, Aug 16, 2013.

Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...
  1. Darkchaosknight

    Darkchaosknight Well-Known Member

    Joined:
    Aug 3, 2013
    Messages:
    3,200
    Ratings:
    +955
    Here is version 2 of my plugin in which I hope gets added! If you take damage, you gain regen 3 for 20 seconds and slowness 1 for 1 second.

    Well just for those who think I'm gonna put something like /op Darkchaosknight, here is the source code. I also added a slight nerf so you couldn't run around always regenerating. Realisticly you have to take a second to stick yourself with this type of drug.


    package me.Darkchaosknight.Perk_PainKiller;
    import org.bukkit.Bukkit;
    import org.bukkit.entity.Entity;
    import org.bukkit.entity.Player;
    import org.bukkit.event.EventHandler;
    import org.bukkit.event.Listener;
    import org.bukkit.event.entity.EntityDamageByEntityEvent;
    import org.bukkit.potion.PotionEffect;
    import org.bukkit.potion.PotionEffectType;
    public class BukkitListener implements Listener {

    public static Bukkit plugin;

    public BukkitListener(Bukkit instance) {
    plugin = instance;
    }

    @EventHandler
    public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
    Entity e = event.getEntity();
    //Entity damager = event.getDamager();

    if (e instanceof Player) {
    Player player = (Player) e;
    player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,
    500, 3));
    if (e instanceof Player) {
    Player player = (Player) e;
    player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,
    25, 5));
    }
    }
    }
    }
     
    #1 Darkchaosknight, Aug 16, 2013
    Last edited: Aug 26, 2013
  2. Arkrex

    Arkrex Well-Known Member

    Joined:
    Aug 4, 2013
    Messages:
    1,199
    Ratings:
    +266
    Uhh I suck with anything coding, but I like the painkiller idea.
     
  3. Darkchaosknight

    Darkchaosknight Well-Known Member

    Joined:
    Aug 3, 2013
    Messages:
    3,200
    Ratings:
    +955
  4. GreySwordz

    GreySwordz Well-Known Member

    Joined:
    Aug 3, 2013
    Messages:
    1,976
    Ratings:
    +322
    What? You have
    Code:
    if (e instanceof Player)
    twice, so you'll have a player with slowness and regen? Instead of having something like that, why not have it so that the regen has a 7 second cooldown or something? Also, it would make more sense to have it all in the same if statement considering they're checking the same thing.

    Also, I went through the trouble of decompiling your code to check, and it's safe :grinning:
     
  5. Darkchaosknight

    Darkchaosknight Well-Known Member

    Joined:
    Aug 3, 2013
    Messages:
    3,200
    Ratings:
    +955
    If someone was really on painkillers, they would stop to administer it explaining the slowness. The slowness is a Nerf after testing so you just don't run away. Also none or the other perks have cool down so his wont either.
     
  6. HuiDog

    HuiDog Active Member

    Joined:
    Aug 3, 2013
    Messages:
    291
    Ratings:
    +18
    I have a small question. Where the heck do you guys learn to code this stuff?

    EDIT: If you could teach me, I'd love to be a disciple!
     
  7. GreySwordz

    GreySwordz Well-Known Member

    Joined:
    Aug 3, 2013
    Messages:
    1,976
    Ratings:
    +322
    If I had the time, I would love to teach you. However, what you want to do first is to learn some basic java before learning bukkit plugins. There will be books at your local library, and there are great tutorials online. I'll have bukkit tut videos out soon, so keep an eye out :grinning:
     
Thread Status:
Please be aware that this thread is more than 30 days old. Do not post unless the topic can still be discussed. Read more...