Advertisement
Guest User

SILLY ERRORS

a guest
Sep 16th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.07 KB | None | 0 0
  1. package me.Rocketboy901.Milk;
  2.  
  3. import org.bukkit.entity.Player;
  4. import org.bukkit.event.EventHandler;
  5. import org.bukkit.event.EventPriority;
  6. import org.bukkit.event.Listener;
  7. import org.bukkit.event.block.Action;
  8. import org.bukkit.event.player.PlayerInteractEvent;
  9. import org.bukkit.inventory.ItemStack;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11. import org.bukkit.potion.PotionEffect;
  12. import org.bukkit.potion.PotionEffectType;
  13. import org.bukkit.Bukkit;
  14. import org.bukkit.Material;
  15. import org.bukkit.Sound;
  16. import me.Rocketboy901.Milk.FireworkEffectPlayer;
  17.  
  18.  
  19. public class Main extends JavaPlugin implements Listener {
  20.     FireworkEffectPlayer fplayer = new FireworkEffectPlayer();
  21.    
  22.    
  23.     public void addEffects(Player player) {
  24.         player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 20*20, 1));
  25.         player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 20*10, 1));
  26.         player.addPotionEffect(new PotionEffect(PotionEffectType.HUNGER, 20*4, 1));
  27.         player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 20*4, 1));
  28.         player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, 20*10, 20));
  29.         player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 20*10, 2));
  30.     }
  31.    
  32.    
  33.      @Override
  34.      public void onEnable(){
  35.          Bukkit.getServer().getPluginManager().registerEvents(this, this);
  36.      }
  37.      @EventHandler(priority=EventPriority.HIGH)
  38.       public void onInteract(PlayerInteractEvent event)
  39.       {
  40.         Player player = event.getPlayer();
  41.  
  42.         if (((event.getAction() == Action.RIGHT_CLICK_BLOCK) || (event.getAction() == Action.RIGHT_CLICK_AIR)) && (player.getItemInHand().getType() == Material.MILK_BUCKET)) {
  43.           event.setCancelled(true);      
  44.           player.getInventory().setItemInHand(new ItemStack(Material.BUCKET, 1));
  45.           try{
  46.           fplayer.playFirework(event.getPlayer().getWorld(), event.getPlayer.getLocation(), Util.getRandomFireworkEffect());
  47.           }
  48.           catch(Exception e){
  49.              
  50.           }
  51.           addEffects(player);
  52.          
  53.  
  54.  
  55.         }
  56.       }
  57.    
  58.    
  59.  
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement