Need help

Discussion in 'Plugin Development' started by iCreepZz, Feb 28, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    iCreepZz

    Hi I need help, I made this but it seems to not work? like i did the plugins.yml with the commands but when i use the command its not working

    Code:
    /* 371 */     if (label.equalsIgnoreCase("gbows")) {
    /* 372 */       if (args.length == 0) {
    /* 373 */         if ((sender instanceof Player)) {
    /* 374 */           Player target = (Player)sender;
    /* 375 */           ItemStack sword = new ItemStack(Material.BOW, 1);
    /* 376 */           PlayerInventory inv = target.getInventory();
    /* 377 */           sword.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 7);
    /* 378 */           sword.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 5);
    /* 379 */           sword.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 5);
    /* 380 */           sword.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
    /* 384 */           sword.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
    /* 385 */           inv.addItem(new ItemStack[] { sword });
    /*     */         }
    /* 387 */         if (!(sender instanceof Player))
    /* 388 */           sender.sendMessage("This command can only be run by a player!");
    /*     */       }
    /* 390 */       else if (args.length == 1) {
    /* 391 */         Player target = getServer().getPlayer(args[0]);
    /* 392 */         if ((sender instanceof Player)) {
    /*     */           try {
    /* 394 */             ItemStack sword = new ItemStack(Material.BOW, 1);
    /* 395 */             PlayerInventory inv = target.getInventory();
    /* 396 */             sword.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 7);
    /* 378 */             sword.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 5);
    /* 379 */             sword.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 5);
    /* 380 */             sword.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
    /* 384 */             sword.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
    /* 404 */             inv.addItem(new ItemStack[] { sword });
    /*     */           } catch (Exception e) {
    /* 406 */             target.sendMessage(ChatColor.DARK_RED + target.getDisplayName().toString() + " is not online!");
    /*     */           }
    /*     */         }
    /* 409 */         if (!(sender instanceof Player)) {
    /*     */           try {
    /* 411 */             ItemStack sword = new ItemStack(Material.BOW, 1);
    /* 412 */             PlayerInventory inv = target.getInventory();
    /* 413 */             sword.addUnsafeEnchantment(Enchantment.ARROW_DAMAGE, 7);
    /* 378 */             sword.addUnsafeEnchantment(Enchantment.ARROW_KNOCKBACK, 5);
    /* 379 */             sword.addUnsafeEnchantment(Enchantment.ARROW_FIRE, 5);
    /* 380 */             sword.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
    /* 384 */             sword.addUnsafeEnchantment(Enchantment.DURABILITY, 7);
    /* 421 */             inv.addItem(new ItemStack[] { sword });
    /*     */           } catch (Exception e) {
    /* 423 */             target.sendMessage(ChatColor.DARK_RED + target.getDisplayName().toString() + " is not online!");
    /*     */           }
    /*     */         }
    /*     */       }
    /*     */     }
    /* 428 */     return false;
    /*     */   }
    /*     */ }
     
  2. Offline

    peteyandpika

    what part isnt working? you shud be specific
     
  3. Offline

    leiger

    Please post the entire method.
     
  4. Offline

    Tomskied

    Looks decompiled..... sneaky sneaky.
     
  5. Offline

    iCreepZz

    I have a plugins.yml with the command /gbow but when I use it ingame it says "/gbows [player]" but doesnt actually give me the bow. And i'm not sure what is wrong

    What i'm thinking is wrong is the and the material. part is wrong
    "ItemStack sword = new ItemStack(Material.BOW, 1);"

    NVM Got it working :p
    /thread please or lock thread

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 31, 2016
  6. Offline

    gomeow

    iCreepZz
    Just don't post in them and they will fall off the main page...
     
Thread Status:
Not open for further replies.

Share This Page