Hey, i was wondering if anyone could help me with a problem im having with a plugin that im working on. Its just a basic party chat plugin, so when a player types pinvite name. It invites the player(s) specified and they can talk. But im having a problem with getting the players names when /pinvite NAME is typed. This is my current code:
But
as it says that Bukkit.getPlayer is deprecated.
HTML:
//Commands
public String help = "party";
public String invite = "pinvite";
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
if (cmd.getName().equalsIgnoreCase(help)) {
sender.sendMessage(ChatColor.YELLOW + "Type '/party invite' to create a party chat!");
}
}
if (cmd.getName().equalsIgnoreCase(invite)) {
Player invited = Bukkit.getPlayer(args[0]);
if (invited != null) {
invited.sendMessage("You have been invited to a party by" + sender.getName());
sender.sendMessage("You have invited " + invited.getName() + "to a party!");
}
else if (invited != invited) {
sender.sendMessage(invited.getName() + "is not online right now!");
}
}
return false;
}
}
But
Code:
Player invited = Bukkit.getPlayer(args[0]);
