Solved Command is not working properly

Discussion in 'Spigot Plugin Development' started by Stellrow, Jul 2, 2018.

  1. So this is just a simple plugin as im learning i registered the command and so but when i use it it does nothing
    Command class:

    Any ideea what i did wrong? And also how do i switch the player tag(above the head as well)?
  2. Do you register your Command in your plugin.yml?

    Btw there is no @Override Annotation on your onEnable() Method
  3. Maybe Player#setDisplayName()?
  4. That doesn't matter, have you learned basic concepts of Java?

    remove player.getDisplayName();

    add player.sendMessage("changed"); see if it sends the message
  5. Post the error message from console.
  6. I've learned the basics of Java. @Override changes nothing, I know. Please show us your plugin.yml and the Exception
  7. The problem will be the plugin.yml, because even the code errors dont are important enough to make an error.
  8. There is no error message in console.also @FatalPacket i changed and it did send the message
    Code (Text):
    name: Prefix
    author: Stellrow
    version: 1.0
    main: main.main
    description: Schimba prefixul
            usage: /nume
            description: Schimba prefixul
    Command class:
    Code (Text):

    package main;

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

    public class Command implements CommandExecutor{
        public final main plugin;
        public Command(main plugin) {
            this.plugin = plugin;

        public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String arg2, String[] arg3) {
            Player player = (Player) sender;
            if(sender instanceof Player) {
            return false;


    Code (Text):
    package main;

    import org.bukkit.event.Listener;

    import net.md_5.bungee.api.ChatColor;

    public class main extends JavaPlugin implements Listener{
        public void onEnable() {
            this.getCommand("nume").setExecutor(new Command(this));
            getServer().getConsoleSender().sendMessage(ChatColor.GREEN + "Prefix a fost activat");
            getServer().getPluginManager().registerEvents(this, this);
        public void onDisable() {
            getServer().getConsoleSender().sendMessage(ChatColor.RED + "Prefix a fost dezactivat");

    Any ideea how i can make it change the name other than setdisplayname?
  9. There is no other solution in Bukkit. With Packets you can change the Name, too. But this needs a modified GameProfile
  10. I guess that says it all thanks for spending the time on me