Advertisement
Guest User

Bukkit Forum Help

a guest
Mar 4th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.25 KB | None | 0 0
  1. package com.jackiejoe4.potions;
  2.  
  3. import java.util.logging.Logger;
  4.  
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandSender;
  8. import org.bukkit.entity.Player;
  9. import org.bukkit.plugin.PluginDescriptionFile;
  10. import org.bukkit.plugin.java.JavaPlugin;
  11. import org.bukkit.potion.PotionEffect;
  12. import org.bukkit.potion.PotionEffectType;
  13.  
  14. public class Potions extends JavaPlugin{
  15.     public final Logger logger = Logger.getLogger("Minecraft");
  16.     public static Potions plugin;
  17.  
  18.     @Override
  19.     public void onDisable() {
  20.         PluginDescriptionFile pdfFile = this.getDescription();
  21.         this.logger.info(pdfFile.getName() + " Has Been Disabled!");
  22.     }
  23.  
  24.        
  25.  
  26.     @Override
  27.     public void onEnable() {
  28.         PluginDescriptionFile pdfFile = this.getDescription();
  29.         this.logger.info(pdfFile.getName() + " Version " + pdfFile.getVersion() + " Has Been Enabled!");
  30.     }
  31.  
  32.     public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  33.         Player player = (Player) sender;
  34.         player.hasPermission("potions.all");
  35.         if (cmd.getName().equalsIgnoreCase("pRemove")) {
  36.             for (PotionEffect effect : player.getActivePotionEffects())
  37.                 player.removePotionEffect(effect.getType());
  38.             player.sendMessage(ChatColor.GREEN + "All Potion effect removed!");
  39.         }else if(commandLabel.equalsIgnoreCase("pHelp")){
  40.             player.sendMessage(ChatColor.DARK_AQUA + "=------>" + ChatColor.GOLD + "Potions Help Menu" + ChatColor.DARK_AQUA + "<------=");
  41.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pRemove" + ChatColor.GRAY + "  | Removes all potion effects!");
  42.             player.sendMessage(ChatColor.GOLD + "-----------------------------------------------------");
  43.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pHealing" + ChatColor.GRAY + "  | Adds healing potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  44.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pRegen" + ChatColor.GRAY + "  | Adds Regeneration potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  45.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pSwiftness" + ChatColor.GRAY + "  | Adds Speed potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  46.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pFireResist" + ChatColor.GRAY + "  | Adds Fire Resistance potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  47.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pNightVision" + ChatColor.GRAY + "  | Adds Night Vision potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  48.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pStrength" + ChatColor.GRAY + "  | Adds Strength potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  49.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pInvisibility" + ChatColor.GRAY + "  | Adds Invisibility potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  50.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pPosion" + ChatColor.GRAY + "  | Adds Posion potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  51.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pWeakness" + ChatColor.GRAY + "  | Adds Weakness potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  52.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pSlowness" + ChatColor.GRAY + "  | Adds Slowness potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  53.             player.sendMessage(ChatColor.AQUA + "=-->" + ChatColor.YELLOW + "/pHarming" + ChatColor.GRAY + "  | Adds Harming potion effect, Level: 4, Duration: 10 mins (12000 ticks)");
  54.     } else if(commandLabel.equalsIgnoreCase("pHealing")){
  55.         player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 12000, 3));
  56.         player.sendMessage(ChatColor.GOLD + "Healing" + ChatColor.GREEN + " potion effect added!");
  57.     } else if(args.length == 1){
  58.         if(player.getServer().getPlayer(args[0])!=null){
  59.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  60.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 12000, 3));
  61.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Healing Potion " + ChatColor.GREEN + "effect!");
  62.         }else{
  63.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  64.         }
  65.    
  66.     } else if(commandLabel.equalsIgnoreCase("pRegen")){
  67.         player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 12000, 3));
  68.         player.sendMessage(ChatColor.GOLD + "Regeneration" + ChatColor.GREEN + " potion effect added!");
  69.     } else if(args.length == 1){
  70.         if(player.getServer().getPlayer(args[0])!=null){
  71.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  72.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 12000, 3));
  73.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Regeneration Potion " + ChatColor.GREEN + "effect!");
  74.         }else{
  75.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  76.         }
  77.    
  78.     } else if(commandLabel.equalsIgnoreCase("pSwiftness")){
  79.         player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 12000, 3));
  80.         player.sendMessage(ChatColor.GOLD + "Swiftness" + ChatColor.GREEN + " potion effect added!");
  81.     } else if(args.length == 1){
  82.         if(player.getServer().getPlayer(args[0])!=null){
  83.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  84.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 12000, 3));
  85.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Swiftness Potion " + ChatColor.GREEN + "effect!");
  86.         }else{
  87.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  88.         }
  89.    
  90.     } else if(commandLabel.equalsIgnoreCase("pFireResist")){
  91.         player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 12000, 3));
  92.         player.sendMessage(ChatColor.GOLD + "Fire Resistance" + ChatColor.GREEN + " potion effect added!");
  93.     } else if(args.length == 1){
  94.         if(player.getServer().getPlayer(args[0])!=null){
  95.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  96.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 12000, 3));
  97.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Fire Resistance Potion " + ChatColor.GREEN + "effect!");
  98.         }else{
  99.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  100.         }
  101.    
  102.     } else if(commandLabel.equalsIgnoreCase("pNightVision")){
  103.         player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 12000, 3));
  104.         player.sendMessage(ChatColor.GOLD + "Night Vision" + ChatColor.GREEN + " potion effect added!");
  105.     } else if(args.length == 1){
  106.         if(player.getServer().getPlayer(args[0])!=null){
  107.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  108.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 12000, 3));
  109.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Night Vision Potion " + ChatColor.GREEN + "effect!");
  110.         }else{
  111.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  112.         }  
  113.    
  114.     } else if(commandLabel.equalsIgnoreCase("pStrength")){
  115.         player.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 12000, 3));
  116.         player.sendMessage(ChatColor.GOLD + "Strength" + ChatColor.GREEN + " potion effect added!");
  117.     } else if(args.length == 1){
  118.         if(player.getServer().getPlayer(args[0])!=null){
  119.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  120.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 12000, 3));
  121.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Strength Potion " + ChatColor.GREEN + "effect!");
  122.         }else{
  123.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  124.         }  
  125.    
  126.     } else if(commandLabel.equalsIgnoreCase("pInvisibility")){
  127.         player.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 12000, 3));
  128.         player.sendMessage(ChatColor.GOLD + "Invisibility" + ChatColor.GREEN + " potion effect added!");
  129.     } else if(args.length == 1){
  130.         if(player.getServer().getPlayer(args[0])!=null){
  131.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  132.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 12000, 3));
  133.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Invisibility Potion " + ChatColor.GREEN + "effect!");
  134.         }else{
  135.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  136.         }  
  137.    
  138.     } else if(commandLabel.equalsIgnoreCase("pPoison")){
  139.         player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 12000, 3));
  140.         player.sendMessage(ChatColor.GOLD + "Poison" + ChatColor.RED + " potion effect added!");
  141.     } else if(args.length == 1){
  142.         if(player.getServer().getPlayer(args[0])!=null){
  143.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  144.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 12000, 3));
  145.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Posion Potion " + ChatColor.GREEN + "effect!");
  146.         }else{
  147.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  148.         }
  149.    
  150.     } else if(commandLabel.equalsIgnoreCase("pWeakness")){
  151.         player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 12000, 3));
  152.         player.sendMessage(ChatColor.GOLD + "Weakness" + ChatColor.RED + " potion effect added!");
  153.     } else if(args.length == 1){
  154.         if(player.getServer().getPlayer(args[0])!=null){
  155.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  156.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 12000, 3));
  157.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Weakness Potion " + ChatColor.GREEN + "effect!");
  158.         }else{
  159.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  160.         }  
  161.    
  162.     } else if(commandLabel.equalsIgnoreCase("pSlowness")){
  163.         player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 12000, 3));
  164.         player.sendMessage(ChatColor.GOLD + "Slowness" + ChatColor.RED + " potion effect added!");
  165.     } else if(args.length == 1){
  166.         if(player.getServer().getPlayer(args[0])!=null){
  167.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  168.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 12000, 3));
  169.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Slowness Potion " + ChatColor.GREEN + "effect!");
  170.         }else{
  171.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  172.         }  
  173.    
  174.     } else if(commandLabel.equalsIgnoreCase("pHarming")){
  175.         player.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 12000, 3));
  176.         player.sendMessage(ChatColor.GOLD + "Harming" + ChatColor.RED + " potion effect added!");
  177.     } else if(args.length == 1){
  178.         if(player.getServer().getPlayer(args[0])!=null){
  179.         Player targetPlayer = player.getServer().getPlayer(args[0]);
  180.         targetPlayer.addPotionEffect(new PotionEffect(PotionEffectType.HARM, 12000, 3));
  181.         player.sendMessage(ChatColor.GREEN + "Someone has given you a" + ChatColor.AQUA + " Harming Potion " + ChatColor.GREEN + "effect!");
  182.         }else{
  183.             player.sendMessage(ChatColor.RED + "Player could not be found D:");
  184.         }  
  185.                     }  
  186.         return false;
  187.     }
  188. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement