Zach443

Untitled

Mar 9th, 2014
115
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.     public void onEnable(){
  16.         getServer().getPluginManager().registerEvents(this, this);
  17.         this.getConfig().options().copyDefaults(true);
  18.         loadConfig();
  19.     }
  20.     public void onDisable(){
  21.         getLogger().info("BYE BYE SGT-SMith ;)");
  22.         getLogger().info("Are you confused yet?");
  23.         getLogger().info("Thats right: I am talking to you through your console");
  24.         getLogger().info("I'm just that good >:)");
  25.         getLogger().info("Bye now!");
  26.        
  27.     }
  28.    
  29.     @EventHandler
  30.     public void onClick(PlayerInteractEvent event){
  31.         Player player = event.getPlayer();
  32.         Player user = event.getPlayer();
  33.         if (player.getItemInHand().getType() == Material.QUARTZ) {
  34.             user.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, invisDur, 5), true);
  35.         } else if (player.getItemInHand().getType() == Material.FEATHER) {
  36.             user.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, invisDur, speedValue), true);
  37.         } else if (player.getItemInHand().getType() == Material.BLAZE_ROD) {
  38.             user.launchProjectile(Fireball.class);
  39.         }
  40.     }
  41.    
  42.     public void loadConfig() {
  43.         saveDefaultConfig();
  44.        
  45.         int invisDur = getConfig().getInt("invisDur");
  46.         int speedDur = getConfig().getInt("speedDur");
  47.         int speedValue = getConfig().getInt("speedValue");
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment