Why won't it work ?

Status
This thread has been locked.

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
Hi, learnt some bukkit coding and made a plugin, made a few simple ones like this before but for some reason, when inputting the commands /hello and /bye I get "internal error occured" minecraft error. There must be something wrong with my code, i have messed with it a bit to make it more concise but I have attached it, please let me know what is wrong with it. I doubt the plugin.yml will be neccessary:

I would've used pastebin but chrome is acting weird saying virus protection doesn't allow it.

http://pastie.org/10856382
 
Banned forever. Reason: Account compromised
PebbleHost
High performance, consistent uptime and fast support. Minecraft hosting that just works.

BluIceCube

Sugar daddy ;)
Banned
Feedback score
1
Posts
455
Reactions
154
Resources
0
anyone?
 
Banned forever. Reason: Account compromised

MajkTwyg

Feedback score
0
Posts
14
Reactions
6
Resources
0
I believe your problem is using == rather than >.

Essentially, you want to check if args.length is greater than 0 otherwise its just going to skip the statements and return false.

If you're still new at development with Bukkit/Spigot and want to learn more I'd be happy to help. My Skype is always open if you need a helping hand.

Skype: majktwyg

Code:
if(cmd.getName().equalsIgnoreCase("hello")) {
                if(args.length > 0) { // <-----
                    Bukkit.broadcastMessage(pName + ChatColor.YELLOW + " says hello!");
                    return true;
                }
                if(args.length > 1) { // <-----
                    Bukkit.broadcastMessage(pName + ChatColor.YELLOW + " says hello to " + tName + fullStop);
                    return true;
                    }
                return false;
             
            }
 
Status
This thread has been locked.
Top