my code is
package me.Doloro.FerretSBPlugin;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class YourMistakesHelpMe {
@SuppressWarnings("deprecation")
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("bruh")) {
Player player = (Player) sender;
player.getInventory().addItem(new ItemStack(Material.DIAMOND_SWORD));
sender.sendMessage(org.bukkit.ChatColor.BLUE + "Check Your Inventory");
return true;
} //If this has happened the function will return true.
// If this hasn't happened the value of false will be returned.
return false;
}
}
I want to to give a Diamond_Sword when the command is typed
there is no error only a {player} has used the command /bruh , Also I am new to coding this so any help would help me a LOT
So it might be because you forgot the "implements CommandExecutor" after "public class YourMistakesHelpMe". I can't check it rn but idk why it wouldn't work.
package me.Doloro.FerretSBPlugin;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class YourMistakesHelpMe implements CommandExecutor {
@SuppressWarnings("deprecation")
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("bruh")) {
Player player = (Player) sender;
player.getInventory().addItem(new ItemStack(Material.DIAMOND_SWORD));
sender.sendMessage(org.bukkit.ChatColor.BLUE + "Check Your Inventory");
return true;
} //If this has happened the function will return true.
// If this hasn't happened the value of false will be returned.
return false;
}
}