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!
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!
6
the reason why it didn't work is that you need to change
plugin.getCommand("hello").setExecutor(this)
to
plugin2.getCommand("hello").setExecutor(this)
plugin.getCommand("hello").setExecutor(this)
to
plugin2.getCommand("hello").setExecutor(this)
The tutorial was done on 1.8
Hmm, you have any tutorials that is done on 1.16.5?
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
