Essentials API

Discussion in 'Plugin Development' started by Cryices, Oct 14, 2013.

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

    Cryices

    Really sorry for having to post threads so quickly and close to each other, but i can't find the problem in this code. with the command being enchant. please help!

    Code:
                            if(args.length == 2){
                            if (args[0].equalsIgnoreCase("sharpness") && args[1].equalsIgnoreCase("1") ) {
                                        try {
                                            if(Economy.hasEnough(p, BigDecimal.valueOf(1000))){
                                                //Do something, perhaps send them a message?
                                                player.getItemInHand().addEnchantment(Enchantment.DAMAGE_ALL, 1);
                                                Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "economy take " + player.getName() + " 1000");
                                                player.sendMessage(ChatColor.BLUE + "Sharpness 1 Bought. " + ChatColor.DARK_GRAY + "-" + ChatColor.GRAY + "$1000");
                                                return true;
                                            }else
                                                player.sendMessage(ChatColor.RED + "You do not have $1000");
                                        } catch (ArithmeticException
                                                | UserDoesNotExistException e) {
                                            // TODO Auto-generated catch block
                                            e.printStackTrace();
                                        }
                                    }
                                }
     
  2. Cryices
    1. Make it easy for our eyes. Plz pase your code using the little code insertion thingy :p
    2. Describe what the problem is or we won't be able to help you :)
     
  3. Offline

    Cryices

    there, and the problem is, the command /enchant sharpness 1 doesn't work! it doesn't send a message nor remove money nor, do anything. but /enchant and /enchant sharpness works!
     
  4. Cryices
    Try changing:

    Code:java
    1. if (args.length == 2)


    to

    Code:java
    1. if (args.length == 1)


    Let's see if that has any effect first. I'll continue trying to see what the problem is

    EDIT:

    or you can simply put:

    Code:java
    1. if (args.length > 0)
     
  5. Offline

    Cryices

    yea, because there isn't alot of help involving Essentials Econ API out there :p
     
  6. Offline

    iiHeroo


    I believe you don't use Essentials Eco API, they use Vault's Eco API, so I think you need to use Vault's API I'm not entirely sure though.
     
  7. Offline

    Cryices

Thread Status:
Not open for further replies.

Share This Page