Zach443

Untitled

Mar 9th, 2014
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.68 KB | None | 0 0
  1. package me.zach.ItemBuff;
  2.  
  3. import org.bukkit.Material;
  4. import org.bukkit.entity.Fireball;
  5. import org.bukkit.entity.Player;
  6. import org.bukkit.event.EventHandler;
  7. import org.bukkit.event.Listener;
  8. import org.bukkit.event.player.PlayerInteractEvent;
  9. import org.bukkit.plugin.java.JavaPlugin;
  10. import org.bukkit.potion.PotionEffect;
  11. import org.bukkit.potion.PotionEffectType;
  12.  
  13. public class ItemBuff extends JavaPlugin implements Listener{
  14.    
  15.     int invisDur = getConfig().getInt("invisDur");
  16.     int speedDur = getConfig().getInt("speedDur");
  17.     int speedValue = getConfig().getInt("speedValue");
  18.    
  19.     public void onEnable(){
  20.         getServer().getPluginManager().registerEvents(this, this);
  21.         this.getConfig().options().copyDefaults(true);
  22.         loadConfig();
  23.     }
  24.     public void onDisable(){
  25.         getLogger().info("BYE BYE SGT-SMith ;)");
  26.         getLogger().info("Are you confused yet?");
  27.         getLogger().info("Thats right: I am talking to you through your console");
  28.         getLogger().info("I'm just that good >:)");
  29.         getLogger().info("Bye now!");
  30.        
  31.     }
  32.    
  33.     @EventHandler
  34.     public void onClick(PlayerInteractEvent event){
  35.         Player player = event.getPlayer();
  36.         Player user = event.getPlayer();
  37.         if (player.getItemInHand().getType() == Material.QUARTZ) {
  38.             user.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, invisDur, 5), true);
  39.         } else if (player.getItemInHand().getType() == Material.FEATHER) {
  40.             user.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, invisDur, speedValue), true);
  41.         } else if (player.getItemInHand().getType() == Material.BLAZE_ROD) {
  42.             user.launchProjectile(Fireball.class);
  43.         }
  44.     }
  45.    
  46.     public void loadConfig() {
  47.         saveDefaultConfig();
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment