1

Plugin Not Working?

NotDelay 12/5/21 5:21 am
89
12/6/2021 7:15 pm
Okay, so i made this plugin (as a first plugin/test) and i followed this tutorial (https://youtu.be/XaU8JKQW0Ao)



i did everything but its not working, nor is the '/hello' thing showing..

Here is the Main java:

package me.Test.Spawn;
import org.bukkit.plugin.java.JavaPlugin;
import me.Test.Spawn.commands.xd;

public class Main extends JavaPlugin{

@Override
public void onEnable() {
//Plugin Starts
new xd(this);
}
}



command:


package me.Test.Spawn.commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

import me.Test.Spawn.Main;

public class xd implements CommandExecutor{
private Main plugin;

public xd(Main plugin2) {
this.plugin = plugin2;
plugin.getCommand("hello").setExecutor(this);
}

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) {
sender.sendMessage("Players are the only ones who can run this command!");
return true;
}

Player plr = (Player) sender;
plr.sendMessage("Helloooo");

return false;
}
}

Thanks!
Posted by
NotDelay
Level 1 : New Miner
0

  Have something to say?

JoinSign in

6

CrazyMango
12/06/2021 7:15 pm
Level 30 : Artisan Lemon
history
the reason why it didn't work is that you need to change

plugin.getCommand("hello").setExecutor(this)

to

plugin2.getCommand("hello").setExecutor(this)
1
wellsilver
12/05/2021 7:24 pm
Level 1 : New Explorer
The tutorial was done on 1.8
2
NotDelay
12/05/2021 8:00 pm
Level 1 : New Miner
Hmm, you have any tutorials that is done on 1.16.5?
1
wellsilver
12/06/2021 6:10 pm
Level 1 : New Explorer
I cant think of any off the top of my head, though you can search youtube for them, or if you already understand it mostly you can look at the bukkit wiki to figure out how to port this to 1.16.5
1
Luka22r
12/05/2021 5:27 am
Level 3 : Apprentice Crafter
It's because we're on 1.18 I tried making some for my server it's because all the plugin websites haven't updated yet
2
NotDelay
12/05/2021 7:09 pm
Level 1 : New Miner
Did this on a 1.16.5 server, still not working?
1

Welcome