Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: Java  |  size: 4.02 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
  2.                 if(cmd.getName().equalsIgnoreCase("test")){
  3.                         Location loc1 = new Location(player.getWorld(), 131, 57, 253);
  4.                           Location loc2 = new Location(player.getWorld(), 137, 67, 247);
  5.                                 int minx = Math.min(loc1.getBlockX(), loc2.getBlockX()),
  6.                                 miny = Math.min(loc1.getBlockY(), loc2.getBlockY()),
  7.                                 minz = Math.min(loc1.getBlockZ(), loc2.getBlockZ()),
  8.                                 maxx = Math.max(loc1.getBlockX(), loc2.getBlockX()),
  9.                                 maxy = Math.max(loc1.getBlockY(), loc2.getBlockY()),
  10.                                 maxz = Math.max(loc1.getBlockZ(), loc2.getBlockZ());
  11.                                 for(int x = minx; x<=maxx;x++){
  12.                                         for(int y = miny; y<=maxy;y++){
  13.                                                 for(int z = minz; z<=maxz;z++)
  14.                                                 {
  15.                                Player p = (Player) sender;
  16.                                p.getWorld().getBlockAt(x, y, z).setTypeId(0);
  17.                                                 }
  18.                                         }
  19.                                 }
  20.                                         return true;
  21.                 }
  22.                 Player player = (Player) sender;
  23.                 if(cmd.getName().equalsIgnoreCase("CustomCrafting")){
  24.                         player.sendMessage(ChatColor.GRAY + "Goto" + ChatColor.GREEN + " http://www.tempeststyle.net/archives/399 " + ChatColor.GRAY + "For Crafting Recipes (Click on the Link!)");
  25.                         return false;
  26.                 }
  27.                 if(cmd.getName().equalsIgnoreCase("premove")){
  28. player.removePotionEffect(PotionEffectType.WEAKNESS);
  29. player.removePotionEffect(PotionEffectType.POISON);
  30. player.sendMessage("Negative Potion Effects Removed!");
  31.             return false;
  32.                 }
  33.                 if(player.hasPermission("CustomCrafting.potion.effects")) {
  34.                 if(cmd.getName().equalsIgnoreCase("potion")){
  35.                         if(args.length == 0){
  36.                                 player.sendMessage("Correct Usage: /potion [potion-effect] [intensity] [length] [playername] or /potion remove [playername]");
  37.                                 return false;
  38.                         }
  39.                         if(args[0].equalsIgnoreCase("list")){
  40.                                         player.sendMessage("All Potion Effects: Speed, Blindness, Confusion, Damage_Resistance, Fast_Digging, Fire_Resistance, Harm, Heal, Hunger, Increase_Damage, Jump, Poison, Regeneration, Slow, Slow_Digging, Water_Breathing, Weakness");
  41.                                         return false;
  42.                                 }
  43.                                 if(args[0].equalsIgnoreCase("remove")){
  44.                                         if(args.length == 1){
  45.                                                 for (PotionEffect effect : player.getActivePotionEffects())
  46.                                                 player.removePotionEffect(effect.getType());
  47.                                                         player.sendMessage(ChatColor.GREEN + "All Potion Effects Removed!");
  48.                                                         return false;
  49.                                         }
  50.                                         }
  51.                                         if(args.length == 2){
  52.                                         if(getServer().getPlayer(args[1]) != null){
  53.                                                 Player p2 = getServer().getPlayer(args[1]);
  54.                                                 for (PotionEffect effect : player.getActivePotionEffects())
  55.                                                 p2.removePotionEffect(effect.getType());
  56.                                                 p2.sendMessage(ChatColor.GREEN + "All Potion Effects Removed!");
  57.                                                 return false;
  58.                                         }
  59.                                         }
  60.                                 }
  61.                 }
  62.                 if(player.hasPermission("CustomCrafting.potion.add")) {
  63.           PotionEffectType pe = PotionEffectType.getByName(args[0].toUpperCase());
  64.               if(args.length == 4){
  65.                 int te = Integer.parseInt(args[1]);
  66.                 int time = Integer.parseInt(args[2])*20;
  67.                 if(getServer().getPlayer(args[3]) != null){
  68.                    Player p = getServer().getPlayer(args[3]);
  69.                    p.removePotionEffect(pe);
  70.                     p.addPotionEffect(new PotionEffect(pe, time, te));
  71.                     p.sendMessage(ChatColor.GOLD + "Set to " + ChatColor.GREEN + pe.getName() + ChatColor.GOLD + " at Intensity " + ChatColor.GREEN + te + ChatColor.GOLD + " for player " + ChatColor.GREEN + p.getDisplayName() + ChatColor.GOLD + "!");
  72.                 }else{
  73.               player.sendMessage("Player is not Online!");
  74.                 }
  75.                 if(args.length < 4){
  76.                           player.sendMessage("Incorrect Usage! Correct Usage: /potion [potion-effect] [intensity] [length] [playername]");
  77.                            return false;
  78.               }
  79.                 if(args.length > 4){
  80.                   player.sendMessage("Incorrect Usage! Correct Usage: /potion [potion-effect] [intensity] [length] [playername]");
  81.                    return false;
  82.                 }
  83.               }
  84. }
  85.                 return false;
  86. }
  87. }