|
Post by SarcasticSarah on Dec 28, 2017 14:31:39 GMT
Today I decided to make plugins with multiple commands and multiple class too but all I got after doing it is a problem, not a problem but some kind of problem :/ this is the problem | (click the picture to see it fully)
v
|
|
XxChrisProxX
Veteran Member
Error 404: Page not found.
Posts: 1,697
|
Post by XxChrisProxX on Dec 28, 2017 14:36:04 GMT
I am going online in a bit we can teamviewer or if you could send me the code you wrote.
|
|
Crëscendø
Veteran Member
Posts: 3,168
| Likes: 1,254
|
Post by Crëscendø on Dec 28, 2017 14:36:47 GMT
Did you register the command in your plugin.yml file? If you haven't, register the command in your plugin.yml file and double check if the command is working properly.
|
|
|
Post by SarcasticSarah on Dec 28, 2017 14:43:16 GMT
I registered the command on the plugin.yml is it possible that I didnt use any ActionListeners or Events?
|
|
|
Post by SarcasticSarah on Dec 28, 2017 14:44:24 GMT
I am going online in a bit we can teamviewer or if you could send me the code you wrote. I need to sleep, maybe tomorrow, add me on discord sarah221#9747
|
|
Crëscendø
Veteran Member
Posts: 3,168
| Likes: 1,254
|
Post by Crëscendø on Dec 28, 2017 15:31:50 GMT
I registered the command on the plugin.yml is it possible that I didn't use any ActionListeners or Events? Depending on the command's usage, it's not always required to have events setup. Make sure your commands are hooked to your main class as well as your events.
|
|
|
Post by SarcasticSarah on Dec 28, 2017 15:41:09 GMT
Does that mean that my command.java files should be hooked up to my main class? like if my main class is Item_Main and my command class is Command_dsword and the Command.java files should be like this?
public class Command_dsword extends Item_Main implements ActionListener
|
|
|
Post by SarcasticSarah on Dec 28, 2017 15:42:17 GMT
I'm completely new to bukkit coding if you're talking about events :/
|
|
Crëscendø
Veteran Member
Posts: 3,168
| Likes: 1,254
|
Post by Crëscendø on Dec 28, 2017 15:58:55 GMT
Does that mean that my command.java files should be hooked up to my main class? like if my main class is Item_Main and my command class is Command_dsword and the Command.java files should be like this? public class Command_dsword extends Item_Main implements ActionListener No, one way of hooking the command to your main class is by going into your onEnable method and adding this: this.getCommand("commandname").setExecutor(new yourclassname());
And for hooking event classes, put this in your onEnable method: this.getServer().getPluginManager().registerEvents(new youreventclassname(), this);
|
|
|
Post by SarcasticSarah on Dec 28, 2017 16:11:23 GMT
Does that mean that my command.java files should be hooked up to my main class? like if my main class is Item_Main and my command class is Command_dsword and the Command.java files should be like this? public class Command_dsword extends Item_Main implements ActionListener No, one way of hooking the command to your main class is by going into your onEnable method and adding this: this.getCommand("commandname").setExecutor(new yourclassname());
And for hooking event classes, put this in your onEnable method: this.getServer().getPluginManager().registerEvents(new youreventclassname(), this);
Do I have to repeat the this.getCommand("commandname")setExecutor(new Item_Main()); if I have multiple command classes?
|
|
Mnpn
Veteran Member
Posts: 957
|
Post by Mnpn on Dec 28, 2017 16:44:50 GMT
Are you returning correctly?
|
|
Mafrans
Veteran Member
We assholes need to stick together, if you're a fellow asshole please pm me.
Posts: 1,760
| Likes: 1,703
|
Post by Mafrans on Dec 28, 2017 20:02:15 GMT
You should look up CommandExecutor and how to use it.
|
|
|
Post by SarcasticSarah on Dec 28, 2017 22:34:50 GMT
You should look up CommandExecutor and how to use it. okay
|
|
|
Post by SarcasticSarah on Dec 28, 2017 22:35:42 GMT
Are you returning correctly? Returning on the onCommand method? return true;
|
|
StevenNL2000
Forum Admin
Posts: 6,415
| Likes: 6,936
IGN: StevenNL2000
Timezone: UTC+01:00
Member is Staff. Need immediate assistance? Send a PM
|
Post by StevenNL2000 on Dec 28, 2017 22:38:29 GMT
You need to return true at the end of onCommand() in all cases. If you return false, it will attempt to show you how to use the command, but that looks weird when the command doesn't have arguments.
|
|